If you create themes for WordPress, free ones to the repository, premium ones to theme marketplaces or exclusive ones for your clients, there are some techniques that you will probably use to preview, debug and profile your work.
The official themes repository and the marketplaces generally have reviews that you have to pass before your theme is listed, and clients, well it’s a good idea to write quality code for clients too. Will turn out better in the long run and won’t break during a core update next month 😉
This post is about plugins. Plugins that will help you, as a theme developer, work in a better environment, producing better markup and better code. Code that will survive updates and require less maintenance in the future, and most importantly, code that can easily be reused.
One of the most important plugins to consider when creating WordPress themes is Theme Check. The basic idea behind this plugin is that it will verify your code and make sure it meets with the review standards of the WordPress.org themes directory. Theme Check creates a new menu item under your Appearance settings.
It currently lets you run over 8000 tests on any of the themes available in your installation, and gives out the results as a list of info messages, recommendations and errors. If you’re thinking of submitting your theme to the WordPress.org repository you have to get rid of all of the errors, since Theme Check also runs during the submission form to the directory and if a single error is encountered, your theme will not go further for the review.
The nice thing about Theme Check is that it’s recommendations can actually generate ideas for your theme and remind you of the WordPress functionality you’re not taking advantage of, like post thumbnails, or post formats. Get rid of all the recommendation messages and you can be sure that your theme uses all of the latest WordPress’ features.
Disable Core Updates
When working with themes and plugins, you’re probably (or hopefully) testing them in different versions of WordPress, with different sets of plugins and different setup configurations. Unless you’re running the latest stable, WordPress will keep reminding you of a newer versions available, which can get annoying at times. Disable Core Updates simply turns them off.
I also found this plugin useful to run in production environments with more than one Administrator-level account. You see, updating themes, plugins and especially the core is a dangerous thing to do on your live website. What I usually do is I run all the updates locally, test them out on a playground (testing) server and then deploy over to production. So this plugin disables core updates and with it activated, I can be sure that the other Administrators don’t accidentally hit the upgrade button.
Dealing with debug messages, notices and warnings in WordPress might be tough, and Debogger makes it a little easier to find your way around. It shows your debug notices in a neat way at the bottom of every page, includes the query count, peak memory usage and the page load time too, very good for performance tuning.
Debogger can also check your markup for W3C validity but for that to work, you’ll have to be running on server that’s accesible by the W3C validation service, meaning you can’t get validity checks when working locally. A neat alternative is Debug Bar which adds a Debug menu to your admin bar for easy access to queries, cache and other useful information about the current request.
Log Deprecated Notices
A neat plugin by Andrew Nacin himself, Log Deprecated Notices creates a new entry under the Tools menu called Deprecated Calls where in a sweet looking table, shows you which deprecated functions have been used, when, how many times and by whom, as well as provides the alternative function to use.
This plugin is of utmost importance if you’re developing themes for the long run, since deprecated functions will eventually disappear, meaning your theme or plugin will simply crash. The Codex has also a got list of all Deprecated Functions in WordPress.
The Debug Queries plugin lists all your SQL queries at the bottom of the page with the time taken to execute the query, the SQL query itself and the place (sort of a traceback) of where it was executed from. If you’re looking for database bottlenecks in your theme or plugin, especially if you’re introducing some custom functionality with custom WP_Query and MySQL queries, this tool is essential to track down where you went wrong and can do better.
Another interesting metric this plugin gives you is the load distribution among PHP and MySQL in percentage, as well as of course the page load time.
WordPress Theme Demo Bar
If you’re showcasing your themes to your clients or perhaps your colleagues for feedback and testing,WordPress Theme Demo Bar allows you to use a single WordPress installation to present more than one WordPress themes. Such plugins are common on theme marketplaces and theme shops which is so much easier than setting up a different environment for each and every theme of yours, although it still doesn’t give you the flexibility of having different contents for different themes too, which is something you’ll probably be looking for when showcasing.
Since we’re a distributed team, we use this plugin on our testing servers together with the Theme Unit Test data to gather feedback, browser and OS checks, various screen resolutions and more. It’s very easy to switch between themes as well as provide direct links to pages with one specific theme enabled using a simple GET parameter.
Go ahead and search the WordPress.org plugins directory for more interesting developer plugins, I’m sure you’ll find plenty. And if you do, let us know about your favorite ones using the comments section below. Thanks for reading and hope you enjoyed it. Don’t forget to follow us on Twitter and subscribe to our RSS feed for more WordPress tutorials, news and reviews!
Update: There’s More!
Seems like this post is quite popular so instead of posting another round of essential developer plugins, we’ll stick them here and we’ll start with Debug Bar.
Debug Bar & Debug Bar Extender
Debug Bar and Debug Bar Extender are two very neat plugins that play along with each other, the former being a container to the latter. The Debug bar itself can give you information about the request, memory, etc. While the extender gives you a better insight of what’s going on under the hood, including cache hits/misses, SQL queries and a very clean profiler with a backtrace of all functions.
If you’re really into tuning WordPress and making it right, you should definitely take a look at this pair who also got mentioned on WordCamp SF by the way 🙂