Categories
how to

Speed Optimisations on WordPress

For years now I have loved WordPress and used it to power just about every site I build. It is however a very heavy system and doesn’t run at its best out of the box. It has taken years but I have now perfected my speed optimisations on WordPress using W3 Total Cache and CloudFlare. Below is a outline of the setup with more details to be released in future posts as I write them.

The first step to making WordPress run fast is a good server. I am currently using Nginx web server natively with no Apache in sight on a 4 core Digital Ocean VPS with 8GB if RAM (currently around 40 sites on the server). In front of this I use CloudFlare for caching and DNS.

CloudFlare plays a key role in this as you will see going forward. CloudFlare not only caches my static content but also the HTML for brochure style content sites with no special functions. This means my server will not even be involved in the requests for busy websites with everything coming off the edge location on the CloudFlare network.

The final piece of the puzzle is W3 Total Cache, a very powerful plugin if you know what you are doing. This is also what allows me to purge the CloudFlare cache when pages within WordPress are changed.

CloudFlare Page Rules for Extreme Speed

The free plan on CloudFlare allows 3 page rules which is enough for brochure style sites and blogs like this site. We are going to create 2 rules to tell CloudFlare how to cache our site.

  1. Cache everything
  2. Don’t cache WP Admin

Assuming you have already added your domain to CloudFlare and changed your name servers this step is very easy. Navigate to your site on CloudFlare and click the Page Rules tab across the top.

Click ‘Create Page Rule’ and enter ‘yourdomain.com/*‘ . Then click ‘Add a Setting’ and select the options as shown below before pressing save and deploy.

CloudFlare Rules for speed optimisations on WordPress

Next we need to create a new rule that will reduce the caching level of key WordPress pages and WP Admin. Click Create Page Rule 1 more time. and enter the settings as shown below

It is important that this rule is number 1 on your list. If it is not simply drag and drop to reorder the list.

Optimising W3 Total Cache

This is where things get a lot more complicated. W3 Total Cache is a very powerful plugin, however, that means it has a lot of settings and options some of which can break stuff. If you don’t know what you are doing at this point I recommend getting a professional to help configure the plugin for your site.

First install the plugin from the WordPress repository. Once installed you will need to do you standard caching settings for HTML caching as a minimum.

Now under Performance on the WP Admin menu click extensions and enable CloudFlare. The click settings next to CloudFlare. It is here where I am going to focus on the exact settings I use and recommend you do the same.

W3 Total Cache for speed optimisations on WordPress

The above setting is by far the most important here. It is this setting that will allow you changes to be seen without waiting 7 days for the CloudFlare cache to expire. With this checked every time you save a page W3 Total Cache will send a request to CloudFlare to purge that page from its global cache and force the new version to be cached the next time the page is loaded.

Categories
how to Uncategorized

Write in Markdown on WordPress

With the new kid on the block, Ghost making a lot of waves with its modern take on “just blogging”. A lot of people have started to take an interest in Markdown for writing and not just the professional writers.

What is Markdown

Before we get into how to work in Markdown with WordPress its probably a good idea to cover a little about what Markdown is and why professional writers love it so much.

Markdown was created by John Gruber over at Daring Fireball and is a syntax for formatting a document using special characters. Writer love this as they don’t need to stop typing to add formatting into there work.

This guide was written in Markdown.

Using Markdown in WordPress

There are 3 main ways to use Markdown in WordPress and in typical WordPress Core style of don’t add features that can be handled in a plugin all 3 require a plugin. You can install any of these plugins in the normal way.

JetPack

JetPack

JetPack is made by WordPress.com and brings a boat load of functionality from the hosted platform over with it. This is probably one of the nicest implementations of Markdown on WordPress.

It uses the text editor already in WordPress. Simply add your Markdown formatted text and hit publish. This has the added bonus of not removing the visual editor, now you do have to save before the visual editor will show you a rendered version of your Markdown document but that is no hardship.

WP-Markdown

WP-Markdown

WP-Markdown completely replaces the WordPress editor with a text area for adding your Markdown formatted article in. This is brilliant if you are proficient in Markdown and never need or want to use the visual editor in WordPress.

WP-Markdown is not all or nothing however, there is a settings page that allows you to enable or disable the plugin for different post types.

PrettyPress

PrettyPress

PrettyPress is not quite all the way to a editor replacement but the Markdown features are not included into the default WordPress editor. Instead you get a button to Launch PrettyPress. This will bring up a new editor page with 2 columns.

The first column is your editor add all your Markdown formatted article here and watch the real time preview update on the right hand column. PrettyPress will even show you your work on your actual theme in real time.

Categories
how to Uncategorized

How to Backup WordPress

Backing up is something every site owner at every level should be doing. Imagine the scenario after 10 years of running your website and all the hard work, content, graphics and community is lost due to a hard drive failure at your host. How do you recover?

But my host will have backups right? No, while most hosting companies do take backups of your site they are almost always limited in some way, for example Hostgator will only back up the first 10GB of data in your account.

The other downside of backups from your hosting company, often you can not restore 1 site its an all or nothing backup – these are called snapshot backups. A complete copy of everything in your hosting account and can only be restored as complete.

The bottom line, you should not rely on you hosting companies backups. Always have your own copies.

In this guide we are going to cover the basic backup solution of backing up to a directory on your server. Now this by its self is not a complete backup and you should always download a copy of the backup to your computer.

Install BackWPup

BackWPup has a free and premium version for the purpose of this tutorial the free version will suffice. This can be installed like any other plugin from the WordPress.org repository.

Create your First Backup Job

BackWpup General Tab

Think of a backup job like a preset that will run automatically on a defined schedule keeping everything safe.

Click on Add New Job to create your first automated back up job. Under the general tab provide the backup job with a name so you can identify it later.

Under Job Tasks on the general tab ensure Database Backup, File Backup, WordPress XML export and Installed Plugin list are checked. This will ensure all the important stuff is including in your backup package.

Leave the Archive Name as it is, you can change this if you want to but we don’t recommend it unless you are running multiple backup jobs.

Under Job Destination we need to select Backup to Folder and a little further down under Log Files we want to email them to ourselves. Now here you have a choice, you can only get an email if something goes wrong and your backup fails or you can get a full log emailed to you every time the backup runs. This is entirely up to you.

Click Save Changes and this will take you to the Schedule tab. First thing first select with WordPress cron under the Start Job. Now the schedule you choose here will depend on how often you add new content on your site.

BackWPup Schedule Tab

For a lot of personal sites you can get away with once a week, companies or sites with multiple authors we recommend daily and for sites with a large community and a lot of user generated content i.e. comments and forums we’d say you should run a backup every hour. You will know how ofter your backup needs to run based on the amount of time every day you spend managing your site, the basic rule is the more time you spend the more frequently you should be backing up.

Under Schedule Type select basic then how often you want to run the backup. For monthly and weekly backups select the day to run on and for all jobs select what time of the day to run. We recommend running the backup at times when your site will be less busy so 3am in the morning is a good choice.

Again click Save Changes at the bottom and then pop over to the DB Backup tab. Here the only thing you need to do is ensure all the tables are selected. If not click all and then save changes. If they are all selected jump over to the To Folder tab.

Leave the Folder to store backups in alone and just change the number for File Deletion to something that both fits in with your hosting disk space and terms and conditions for storing files on the server as well as your piece of mind. We recommend you store at least 30 days worth of backups if your hosting company will allow this.

Run Your Job

Now that is it. Your job will run on schedule and automatically backup your site. However you should run the job manually now to make sure everything is working. Jump over to the Jobs and click Run Now under your Job Name, this may take 10 – 20 minutes to run depending on the size of your site.

Download Your Backups

BackWPup Backups

While these backups will protect you from human error on your site they will not protect you from hard drive failure on your server as they are stored on the same hard drive as the site. You should always download your backups to your local computer for complete piece of mind.

To download your backup packages head over to Backups. Here you will see everything backup currently held on your server. Simply click Download on the packages you wish to save.

Categories
how to Uncategorized

Write Drunk, Edit Hungover

I have mentioned something along these lines in the past on this blog however the Editor of Modern Drunkard Magazine takes this one step further.

Frank Kelly claims writing drunk and editing while hungover is the best way to smash out work and then cut the fluff.

hangovers are, however, perfectly suited for making hard and cruel decisions, so they’re fantastic for editing. When you’re in that sort of mood, it’s easy—even enjoyable—to bayonet those ‘little darlings’ writers are always trying to sneak into their work.

I highly recommend you read the full article here.

Categories
how to Uncategorized

9 Ways to Use Todoist Labels

Recently Todoist beat me to the punch on a blog post on how to use labels in Todoist so rather then spend time and energy finishing my post I am just going to point you in the direction of the Todoist Blog.

“Get everything you need to do out of your head and into a productivity system.”

It’s a great piece of advice, in theory. But when you have a long list of tasks to deal with your to-do list can quickly become overwhelming. Deciding which task to do when begins to take up the precious time you could be using to actually get things done.

Luckily, Todoist allows you to create labels and filters so you can easily see only the tasks that you can realistically work on based on the context or situation that you’re in.