The Latest Articles:
Publish On

I haven't published this yet !

Did you start any draft posts between 2.9 and 2.9.1?  Have you noticed when you go back to those drafts, finish the post and publish they seemed to disappear, kinda?

I’ve had that happen on a couple of my blogs.  I tend to take ideas and quickly start a post.  Sometimes from the quickpress editor on the dashboard I’ll jot down a few key points to the post and give it a title.  Later I’ll come back and flesh out the post, add the images and publish.

But a couple of weeks back a post I started on January 1, 2010 but published last week simply disappeared.  It wasn’t on the home page.  I checked and found that when I hit publish it had the January 1 date set as the publish date instead of the typical Publish immediately.  It only took a couple of seconds to edit the post and make it current.

I’ve found 4 draft posts with the publish date already set to the day I started the post.  Since the 2.9.1 upgrade I haven’t noticed this annoying gnat.

Therefore, check your draft posts.  If you see something like the image at the right you should edit the date before you publish the post.

Just a Lab heads-up.  You don’t have to write it again, you have to find it.

  • Share/Bookmark

Post Tags:

PHP is great, but there is one thing about it.  It has to be loaded with a call to the database to grab the data to display.  Each of those “calls”, a database query takes little bit of time to execute.  Therefore, if you can save a few of those trips to the database you have increased your load time.

Theme Design is Generic

Theme designers use PHP calls to fill in things like the Site name, description, etc.  The data they pull is usually in the header, footer, and sometimes in the sidebar.

But now that we have the theme chosen for our site that data isn’t going to change.  We can use this to speed up the load time of our site.

Before we go making changes to our theme header.php and footer.php we should make a backup of our theme files.

Now that the backups are made we can decrease the database queries and hopefully gain a bit of speed on our load times.

For a benchmark if you have already installed the code to your theme that tells you your load time and queries executed then write that down.  After you are done check to see how many queries to the database were saved.

If you aren’t familiar with what I’m talking about here is the code.
<!– <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. –>

Paste this in your footer.php just before the close body tag “</body>”

Replacing PHP with HTML

Here are the step we will take and I’ll use one of my photo blogs as an example.   We should see  a decrease in the number of database queries.  For this example we will only be modifying the header.php file.

  1. Open the header.php file
  2. Find php code calls to stylesheets, blog title etc.
  3. View the blog in a browser tab
  4. Right click and “Veiw Page Source”
  5. Find the HTML code that the PHP generates
  6. Copy the code
  7. Paste the HTML into the header.php where the PHP code is currently.
  8. Save the header.php
  9. View the blog after making the change to verify it is all there.
  10. Right click and “View Page Source” and compare to the one you copied from
  11. Check to see the page load time and number of queries executed.

Header PHP code Replacement

Header code:

<link rel=”stylesheet” type=”text/css” media=”all” href=”<?php bloginfo(‘template_directory’); ?>/css/960.css” />
<link rel=”stylesheet” type=”text/css” href=”<?php bloginfo(’stylesheet_url’); ?>” media=”screen” />
<link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″ href=”<?php if ( get_option(‘woo_feedburner_url’) <> “” ) { echo get_option(‘woo_feedburner_url’); } else { echo get_bloginfo_rss(‘rss2_url’); } ?>” />
<link rel=”pingback” href=”<?php bloginfo(‘pingback_url’); ?>” />

Replace with:

<link rel=”stylesheet” type=”text/css” media=”all” href=”http://www.paintingtucson.com/. . ./css/960.css” />
<link rel=”stylesheet” type=”text/css” href=”http://www.paintingtucson.com/wp-content. . ./style.css” media=”screen” />
<link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″ href=”http://www.paintingtucson.com/feed/” />
<link rel=”pingback” href=”http://www.paintingtucson.com/xmlrpc.php” />

Header H1 Code:

<h1><?php bloginfo(‘title’); ?></h1>
<h2><?php bloginfo(‘description’); ?></h2>

Replace with:

			<h1>Painting Tucson</h1>
			<h2>With Light</h2>

Is it worth it? In most instances I don’t think it is. In our example, by making these changes I saved 3 queries. It went from 116 queries to 113 loading the home page.

So why bother?  For most of my smaller blogs I don’t.  But for the Tucson blog where I have over 800 posts and about 100 pages it saved a lot.  For one reason, I have a lot of custom community pages on that blog.  Those links were all listed in the sidebar.  Those pages never change.  By taking those sidebar links and turning them into straight HTML I saved close to 70 database queries on every page load.

Before starting this project that blog would take about 7 seconds to load and 9 seconds wasn’t uncommon on some of the pages with more than one image.  Now, with gzip and a few of these kinds of tweaks to the site I’m seeing some 1.9 second page load times. That is a significant difference.

You be the judge.  If you don’t need to do this, don’t bother.  (If you change themes, you have to do it all over again).  But if you have a lot of database queries and your page load times are lagging then squeezing every millisecond out of your load time is worth it.

  • Share/Bookmark

Post Tags:

File Uploads to  Your Wordpress Blog for the Road Warrior

The WP Easy Uploader is a great tool for your blogging toolbox even if you don’t use it very often.

Enable Gzip Compression

One of the things that Page Speed recommended was to Enable Gzip Compression. I’m not going to go into all the ways I tried to implement this (and blew up the site in the process. I’m going to cut to the chase and show you the steps it took to get this in place and working.

The Firefox Page Speed Add-on

Once you add the Page Speed Add-on you will think you have slipped down the rabbit hole with Alice. You will wonder if you are on a Speed trip yourself (not that I can tell you what that is like)

Woopra Analytics Plugin Reveals TOO MUCH

Your Tracking will be un-interrupted and you won’t be giving away your name and email address to every spam dick and harry in the universe.