In part one I looked at graphics and page length and how to optimize them for speed. Today I am going to go through a couple of areas that require getting your hands dirty.
One of the first things to look at is your theme (what do you think of my new theme). I have just changed my theme and one of the things you may have noticed is how the page loads – not the best – if you can’t remember – hit refresh. The sidebars load first and the content last. This is not ideal. The first thing the reader sees are the sidebars and they have to wait for the content to appear. Over the next few days I will look to change the order so that the content appears first – it is only an illusion – but to the reader the page appears to load faster as they are getting the content first.
My second tip involves unnecessary code. Over time you have probably involved yourself with some of the activities of other sites – you may also have installed plugins. Sometimes these sites/plugins ask you to include a snippet of code in your header, footer or within the body. How many of these sites/plugins are you still involved with? Yet you still have their code embedded. On a slightly different note, if you change themes, these code snippets don’t migrate across to the new theme. If you have installed plugins, some of these will not work correctly because you don’t have the snippets of code embedded. I keep a notepad log. Every time I insert a piece of code I note the date, where I put the code and the code itself. I regularly go through it and delete the snippets of code that are no longer necessary. If I change themes I have all the code there ready to place into the new theme. Changing themes is also a good time to review your plugins. If you are not using them then at least deactivate them. These are only marginal changes to speed – but every microsecond helps – and its good housekeeping.
My final tip for today is a little more complex. I suggest you make copies of any files you change so that you can restore them if things go wrong.
WordPress uses PHP as its basic code. A browser will read the PHP code, turn it into a form HTML and then render the results to the screen – your blog page. However, once you have installed your theme there are several areas that remain static – they don’t change. Headers and footers are classic examples in most blogs.
If you look at the header file it contains a lot of meta data and probably the code to load the page header graphics and title. This code may appear at the top of the index file. If you are happy with the page heading and don’t propose to change it in the future, then it is pointless to have the code in PHP which is much slower to interpret that pure HTML. If you check your pages HTML code (click View, Page Source) you can see the PHP code converted to HTML.
The trick now is to determine what is stable and not going to change and what is constantly being changed. Once you have determined what areas are static, copy the HTML code from the page source and paste it over the PHP code that generates this code. For example, the PHP for this pages title is:
<div id=”blogtitle”>
<h1><a href=”<?php echo get_settings(‘home’); ?>/”><?php bloginfo(‘name’); ?></a></h1>
</div>
The HTML code is:
<div id=“blogtitle”>
<h1><a href=“http://myradicalblogs.com/”>My Radical Blogs</a></h1>
</div>
Only a minor change to the code, but since the browser doesn’t have to interpret the PHP it will load fractionally faster. As I said earlier, each of these fractions add up and you would be surprised at much quicker you can get your page to load. The page title is just one area, there are others. You can also look at the footer file. Another side note – if you change themes your META data does not migrate across to the new theme. Before changing themes, copy the relevant META data such as title and keywords. Once you have installed the new theme go to the header file and past the META data across – this step is often forgotten when installing a new theme. If you have installed a new theme at some stage, go and check the META data – is it up to date.
Tomorrow Part 3.



Nice tips.
Keep it coming Les.