Top 5 WordPress Theme Mistakes

After reviewing a countless number of WordPress themes from professionals and novices alike we have put together the top 5 most common mistakes we find in WordPress themes. The problem with these mistakes is that they can go unnoticed during development and cause all sorts of problems when you finally try to use your theme – especially if you are using plugins with your theme.

Forgetting the WordPress Head Function

The wp_head hook is perhaps the most important theme hook that a huge number of plugins use to include the necessary code enabling them to run on your web site. If you forget to include in your themes header you can expect to a bunch of plugins to break. So, if you happen to notice some bizarre problems with plugins that have worked for you before, double check to make sure the theme you are using has a call to somewhere in the section of your theme’s code.

One of the things that the wp_head() function does is include javascript scripts that have be queued up using the wp_enqueue_script() function (more on this function later). So, if your theme has some in-line javascript that uses jQuery, for example, make sure the function call appears before you start writing jQuery code. Otherwise, your jQuery code will start throwing errors such as “jQuery is undefined” or something similar.

Forgetting the WordPress Footer Function

Like the wp_head() function call, the wp_footer() function call is also heavily used by plugins like the Google Analytics plugin, the Get Clicky Analytics plugin and many other plugins that need to include code at the bottom of your web page. So be sure to include a call to in your theme’s footer.php file. A good place to put it is just before the closing tag.

Hard-Coding The Link To jQuery

As mentioned in the comments about missing wp_head() function calls, the wp_enqueue_script() function call provides a safe and efficient way to include javascript resources in your theme. Several plugins and even certain aspects of your theme may require the use of jQuery or some other javascript library. If they all hard code links to your jQuery library you end up including the library multiple times and all kinds of vexing errors pop up. If you always make a habit to include javascript libraries using the wp_enqueue_script() function, then WordPress takes care to make sure that it only includes the specified library one time, even if there are multiple calls to wp_enqueue_script() in the plugins and the theme you are using.

Also, you might not know that WordPress includes a copy of some of the many popular javascript libraries including scriptaculous, thickbox, jquery, tinymce, and prototype. Take a look for yourself, they are in the wp-includes/js folder of your WordPress installation. So if you want to use jQuery, for example, all you have to do is this:

And WordPress will include the jQuery library for you. Just remember to include a call to wp_head() in your theme’s header.

Forgetting The Image Styles

When developing a theme it’s easy to forget to include all of the css that the TinyMCE WYSIWYG editor uses for positioning images that you insert into your posts or pages. So, be sure to put the following css into your style.css file to make sure your you can align your images using the visual editor.

  img.alignright {float:right; margin:10px 0 1em 1em}
  img.alignleft {float:left; margin:10px 1em 1em 0}
  img.aligncenter {display: block; margin-left: auto; margin-right: auto}
  a img.alignright {float:right; margin:0 0 1em 1em}
  a img.alignleft {float:left; margin:0 1em 1em 0}
  a img.aligncenter {display: block; margin-left: auto; margin-right: auto}

File Permissions Preventing WordPress From Updating

File permissions may be a little bit technical and, depending on your web host, there might not be anything you can do about it. Nevertheless, it’s still worth mentioning because with the right file permissions you can make life much easier by enabling WordPress to automatically upgrade your plugins and even your WordPress installation itself with just a couple clicks. The best scenario is when all the files in your web site are “owned” by the same user that WordPress (your webserver) is running as. This means that WordPress can write to all of your files and directories enabling it to update your plugins and such without requiring you to enter any FTP information. We have our servers set up to work this way as we find it’s by far the easiest for our clients.

Some web hosts, however, are not set up this way. So, as a bare minimum, you need to make sure that WordPress can write to the wp-content/uploads directory so that you can upload media to your server through the Media Manager within WordPress. This lets you add images to your webserver and then insert those images into your posts and pages.

If you have any other tips or think we left out some important points, please leave your comments below. Likewise, if you ever need help with your WordPress system please feel free to contact us.