Tips for WordPress Theme Developers

The WordPress theme development market has grown incredibly in the past few years and with so many companies and freelancers around, how do you stand out? In this post we bring you five tips on how to make your theme easier to use, avoid frustrating customers, use WordPress to the max and provide better and cleaner code for WordPress developers.

1. Keep it Simple, Less is More!

I agree that features in themes are cool, hundreds of shortcodes, thousands of widgets and millions of theme options, but do your end users really need all that? Why waste your time doing something that will never be used, or worse, make your them confusing or conflict with plugins?

A great example is Google Analytics. If you’ve built in support for the GA tracking code in your WordPress theme, your end users can use that to track their visitors, right? Yes, but what happens when they stop using your theme? Their analytics stops working. There are various Google Analytics plugins available so just make sure you’re using functions like wp_head and wp_footer in your theme in order for them to work.

Another good example is SEO. Having good, semantic and easy to understand markup is always a must, but building in a bunch of SEO options like meta descriptions, titles and keywords is too much. What happens when your end user switches to a different theme? They loose all their data which is pretty difficult to restore. Again, there’s a good plugin to solve that.

If you do bundle options with your theme, make sure they’re easy enough to understand. You can provide a documentation or a screencast, but ideally your end users should be able to use your theme without having to learn anything new. A great example is of course Twenty Eleven.

Widgets, shortcodes and custom post types require a separate blog post, but when taking such decisions, always ask yourself the question on what happens when users stop using your theme. You don’t want them to, I know, but eventually they will, and the most frustrating thing that can happen during a switch is loss of data, meaning they’re locked in — our next tip.

2. Avoid Lock-in Effects

The lock-in effect is when your end user is locked in to using your one specific theme only, and if they do decide to switch, they will loose some or all their data. This is somewhat related to the point discussed above and of course you’ll be more than happy if your customer is locked in to using your theme, right? But your customer won’t.

They’re locked in to using WordPress already, although various export tools are available for transitioning to other platforms. Of course developers and geeky users can always work with raw data in MySQL or XML but others can find it pretty difficult and frustrating that they have to.

One of the easiest ways to solve this could be through plugins, either code compatibility for existing plugins or write your own. Yes, plugins can (and usually do) have lock-in effects too but as long as the plugin works with the majority of available themes (whether yours or third-party) then there’s no reason to turn it off.

If your theme has got three extra social widgets, write them as a plugin so that your customer can take the widgets with them to a different theme when they choose to do so. And also think about when your customer arrives with three existing widgets that they’d like to use with your theme, and make sure you provide appropriate fallback CSS styling for all the widgets, including standard ones. Besides, that’s just good practice ;)

It’s quite difficult to completely avoid lock-in effects, I agree, but that should be your goal. For example, why code a new gallery post type to embed photos in your WordPress theme if you can simply use WordPress’ built-in gallery features that work across the majority of themes? Which brings us to the next tip.

3. Don’t Reinvent the Wheel

I’m pretty sure you know that WordPress is not just a blogging platform these days and a lot of WordPress developers are overlooking the API that WordPress provides to it’s themes and plugins developers. Dig into the WordPress core, learn from the standard WordPress themes and look at what other developers are doing.

Of course you won’t find everything in the Codex but just keeping up to date with the changelogs of new WordPress releases is a good start.

WordPress has built-in support for image sizes and post thumbnails since version 2.9, that’s 2009 and you won’t believe how many themes are still using scripts like TimThumb these days. Other examples are background colors and image choices, navigation menus, the color picker script, the HTTP API, RSS feeds functions and a lot more.

A couple of days ago I even discovered a function called get_date_from_gmt which I found very useful when working with dates from Twitter. I never knew it existed before digging into the core, as well as checked and selected!

We wrote a more general article earlier called 5 Tips for Becoming a Better WordPress Developer which covers things like contributing, staying up-to-date and following the coding standards and best practices.

4. Theme Check and the Theme Unit Test

Seems like there will never be enough blog posts and articles about these so it’s worth mentioning them both again here. Theme Check is a WordPress plugin developed for the WordPress Theme Reviewers Team which runs a few thousands of tests against the theme sources.

You’ll have to use this plugin and pass all the tests if your goal is to get listed on WordPress.org, but using it for premium theme markets and even simple client jobs is a good idea as well.

The Theme Unit Test is an XML export of demo data that outlines most of the features built into WordPress, and while being mandatory for WordPress.org themes, it’s a good idea to quickly run through the tests when working with theme markets and client jobs.

With this test you’ll know that your h6 tag is styled, that nested lists are supported, that images and videos won’t break your design layouts and so on. You won’t have requests like “I inserted a right-aligned image in the editor but it’s not right-aligned on the site” if you know what I mean ;)

There are other plugins to help you in your general theme development workflow and we’ve listed some of them in this post: Essential Plugins for WordPress Theme Developers.

5. Think Child Themes

Child Themes is a great way to extend or modify existing (parent) themes by overriding template files and taking advantage of actions and filters available in the parent theme.

When creating a WordPress theme keep in mind that your theme may (and probably will) be used by WordPress developers, so why not make their life easier by adding those extra actions and filters and keeping your files and markup structure easy enough to adapt and build upon? Don’t overdo it though ;)

The best way to find out whether your theme is good enough to be a parent theme is to try and build a child theme yourself. Try adding a third column if your theme is two-column. Try adding a new page template, try adding a new option in your Theme Options panel, etc. We published a tutorial on how to create a child theme based on Twenty Eleven a while ago, which should give you a good kick-start.

And at the end of it all, do provide a short documentation to WordPress developers about the available actions and filters, about the template files and other assets. Ideally you’d like to build a Wiki and have (or better follow) a naming convention, so that developers wouldn’t have to learn new things when working with other themes you’ve built.

Conclusion

These are only a few tips that can make you stand out from the crowd. Do keep in mind that your code, features and documentation is only one part of the WordPress theme and that your design is the second and probably a larger one when it comes to theme markets. Make sure your design is top-notch and pixel perfect and that your theme demo is as complete as possible.

Have you got other tips to WordPress theme developers? Let us know by using the comments section below. Thank you for reading, sharing and staying tuned!