It’s amazing how many designers out there still don’t follow the best practices when creating WordPress themes. When ordinary bloggers download your theme and encounter horrific error messages, what are the chances that they’ll figure out how to fix it?

The most common culprit is required plugins. Do not assume that everybody uses the same plugins you do. Do not assume they will immediately read your README upon download, and follow your instructions. It is your responsibility as a theme designer to anticipate this behavior and make the adjustments in case the person using your theme chooses not to use the plugins you require.

Take for example the Smart Green theme. If you’ll click on View Demo, you’ll find an error message on the right sidebar, and the rest of the page stops loading because of it. Here’s the error message:

Fatal error: Call to undefined function akpc_most_popular() in /home/freeword/public_html/wordpress/wp-content/themes/greentheme/index.php on line 7

The undefined function is found in the Popularity Contest plugin, and the theme calls it this way:

<?php akpc_most_popular($limit = 3); ?>

The error could have easily been avoided using the following code (emphasis given to the inserted code):

<?php
if (function_exists('akpc_most_popular')) {
akpc_most_popular($limit = 3);
}
?>

What this does is ask WordPress if the Popularity Contest plugin exists or is activated first. If the plugin is there, it goes on to display the most popular posts; if it isn’t, then the code is skipped and the rest of the theme loads. You can apply this to any other plugin you want to use in your theme. You just have to supply the name of the function your using instead.

Very easy, very simple. What’s stopping you from foolproofing your WordPress theme?