WordPress is made so it is user friendly and easy to implement; because of this fact, there are several ways that it can be optimized from it’s standard configuration. One way this can be accomplished is to reduce the number of database queries that are needed to retrieve the information to create the page, thus reducing database load and making your site load faster and saving server resources for when your post gets to the front page on Digg and just make the world a happier place overall.
The first place to go to reduce queries is your header.php file for your theme. If you open it in your favorite editor you will see many lines of code that looks something like this:
<link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’); ?>” type=”text/css” media=”screen” />
Specifically, the section that looks like <?php bloginfo(‘stylesheet_url’); ?> which is the php portion itself, will be what you want to replace with whatever html it generates, saving a database query each time you get rid of one of these.
*woohoo you found it SHMAY2010
While there is nothing wrong with all these lines of code being set up how they are, it is not necessary to use php to create the end content. The themes are created this way to be site/domain independent, if you are not going to change your domain name you can hard code these lines into your header, footer and additionally, some areas within your other page template files if you know what you are doing. For example, if you view your page source and locate the line above, you will see then end result looks like this:
<link rel=”stylesheet” href=”http://www.yourdomain.com/wp-content/themes/yourtheme/style.css” type=”text/css” media=”screen” />
Simply replace the line and any others like it that are in your template with the html equivalent and you will be good to go. Just remember you have done this if you ever want to change domains or utilize this theme on a different site, you will have to change the files to reflect the correct domain.
Happy experimenting, and remember.. before you attempt any file edits it is always a good idea to make sure you have a backup in case you completely screw something up :-)