WordPress Website Optimizations
WordPress itself is a fairly wonderful tool. Since switching to it, I find it is a lot quicker to make changes to my website and it is also quicker to get content out to the public, with the use of WordPress and the advise from https://www.salesforce.com/products/service-cloud/what-is-self-service/ I have everything I need for my online business. My optimization suggestions are coming from the point of view of a programmer, and may be slightly more advanced in some places than most WordPress work. Gumroad alternatives are good ecommerce platforms to start and grow your business online. I’m going to assume though that most of you are here for my optimization recommendations, and may just skip straight over this, so let’s get to it.
1. Decrease image file sizes!
I have saved over 200KB in images per page alone by optimizing my site. Since I started with WordPress, I have used the same theme from the word go because I simply love it, I think it looks nice, and looking at it now, you wouldn’t really notice any difference unless you took my site when it started, and now, and put them side by side on a per pixel magnification.
What does this mean as a website owner? Well if you have for example a theme size of 300KB and 10GB of bandwidth a month with an average of 1000 visitors a day. Say each visitor downloads 2 pages (without caching), then you have 1000 * 300 * 2, which is 600MB of data a day! Even if you have caching and manage to get 1000 * 300, that is still a whopping 300MB of data every day. Which means you are pulling anywhere between 9GB and 18GB of data, and your server will simply stop accepting visitors. This is what I was looking at before I started optimizing my images intensely, and now with about 80KB of images on every one of my pages, having saved over 200KB, I have gone from 9-18GB of data, down to about 4.8GB. Keep in mind that this is just from images, and what this means for you is that you don’t have to pay as much for website hosting.
Simply by loading up the images in an editor such as Adobe Photoshop, which has a nifty little feature under the File menu, called “Save for web..”. This allows you to get a side by side comparison and test different configurations for images. The main thing I want to point out with this feature, is don’t be afraid to lose a little quality. If you look at this page, can you tell where I have saved precious kilobytes? I can honestly say that every image you see has been decreased in size (yes, even those 1 pixel thick lines).
Don’t be afraid to play with file types either. It may mean that you have to go in and change your style sheets to point to the new file extension instead of the old one, but if you have a good template (I consider the template I am using fairly good as it is easy to customize), then it is often just one line you need to adjust. Switching some images on my site from PNG to JPEG, I have gone from a 60KB image to a 10KB image, in several places.
2. Remove unwanted Widgets
Widgets start off fun, I loved them and had about 9 in my side column at one stage. But widgets require extra scripts and code to be downloaded. Do you really need to list your most recent forum posts on every page? Do you need a cloud tag on every page? Do you need a login link on every page? I still like having a couple of Widgets around, and you can keep them there to test out your site, but if you are using something like Google Analytics, you can see just how much they are used. And in my case, it was nowhere near enough to warrant keeping those widgets around using valuable resources and kilobytes.
3. Hack your Plugins!
This is a fairly advanced optimization, and requires some knowledge of PHP. But if you are a coder like myself, then you can quite often save a lot more bandwidth by hacking your plugins. This is also not very generic and should be done on a site to site basis.
Plugins are not smart, in fact most of them are fairly stupid, and by this, I mean they do not know where and when they are needed. For example, and this is nothing against the plugin, I use it and love it, but WP-Forum has style sheets which load images, and also has many scripts of it’s own that it uses. But this plugin has no idea whether or not you are in the forum, or if you are in a regular page on your site, and because of this, WordPress will load the plugin on every page of your site. I found this out by using a tool to check the speed of my site and it’s content loading, which you can find it at http://tools.pingdom.com/. When testing my site, I was noticing images and scripts from my WP-Forum plugin on pages that didn’t have anything to do with my forum. At first I thought it could have been the Widget I was using at the time which showed my latest forum posts, but after removing that, I still got the same style sheets, images and scripts loading as before.
But for a coder, if you know what to do, you can limit this to happening only on the pages you want. In this case, every page that relates to the forum contains the word forum in the full URL. Or if you want to be less generic and have a page with forum in the address (which isn’t related to the forum), in this case I could have gone with wpforum or even wpforumaction. I chose to go with the string “forum” as I rarely mention it in a title (maybe once or twice) outside of my forum pages. So if you open up the right file for your plugin and find the code where it loads in any scripts or styles, then you can check if this specific string occurs in the URL, and then decide whether or not to load the scripts and styles.
I’ll give an example.
Say I have the URL:
The full URL of this according to PHP is:
This URL contains the string “forum” in at least one location, in this plugin, it’s in the wpforumaction command.
In PHP we can add this code to the file that loads in the style sheet:
More to come!
I have some more optimizations that I would like to share later on, but I am being called away at present for chocolate chip cookies (this is a blog, I can take a seemingly technical document and make it personal :p ).
Or if you want, feel free to share your own optimizations.