WINTER SALE: Get All Themes Package (36 Themes) for only $119 View Details →

7 Essential Tips for WordPress Theme Developers

Written by Dumitru Brinzan on in WP Themes 12 comments

When I first started with WordPress (in March 2009) I already had over 3 years of PHP experience. I was used to developing my own CMS engines for my clients, so the first days with WordPress were rather curious: changing core WordPress functions, templates, etc.

After that, with the help of Pavel (@ciorici), I decided to play by the rules: learn The WordPress Way.
Think the way WordPress thinks, instead of working around it.

I hope this list of advices will help starting WordPress theme developers as well as some more experienced ones.

1. Learn all Template tags

When coding a design into WordPress, you really should pay attention to Template Tags. Of course you can achieve the same thing by simple php coding, however, it is better to stick to WordPress Template Tags as much as you can.

For reference: http://codex.wordpress.org/Template_Tags

2. Learn all WordPress options

A common “mistake” of theme developers(coders) is that they forget about WordPress Options.
What is that you may ask? Well, remember all those default options that can be set in Dashboard > Settings? That’s what I’m talking about.

Let me give you a simple example:
Many themes have hardcoded the format of post date and time:

[sourcecode language='php'][/sourcecode]
The visitor in turn would see something like this: June 10, 2009 at 10:53

However, what if the blog’s administrator would like to have a different time format? He goes to Settings > General, changes the format and… nothing. The theme still shows the old format.

The correct way to do it would be similar to this:

[sourcecode language='php'][/sourcecode]

Now the administrator is in full control over how the date and time is shown. Less frustration for your clients, less support tickets in the forums :)

For reference: http://codex.wordpress.org/Option_Reference

3. Learn all WordPress functions

If you would like to make major changes in the basic layout of a blog, you will probably have to rely on many functions and conditionals.
Sometimes, if you have a couple of years of PHP experience (guilty), you would decide to “make things better” and end up writing many functions of your own.
That will steal time [and flexibility].
Always try to rely on core WordPress functions. Your customers will thank you later.

For reference: http://codex.wordpress.org/Function_Reference

4. Add basic styling to core WordPress widgets

If you plan on developing more than 1 theme, I recommend creating common style templates for a couple of basic (but popular) WordPress widgets, such as: Archives, Calendar, Search, Tag Cloud, etc.
Wordpress always uses same ID and Class for these widgets, so it is not hard to find them and include in your stylesheets.

Even if they don’t quite fit into your theme design, try to do that. That will earn you some karma points.

5. Don’t rely on third-party plug-ins and widgets

This is another common mistake: theme developers “assume” that users will have certain plug-ins installed. To make matters worse, they include functions from these plug-ins without checking for their presence.

For example if you want to use the WP-Pagenavi navigation instead of the default WordPress navigation.

Doing it wrong:
[sourcecode language='php'][/sourcecode]
In this case, if the plug-in is not installed, WordPress will stop executing anything after this line. This is the reason why some themes “break” unexpectedly.

Doing it right:
[sourcecode language='php'][/sourcecode]

6. Create template files for all elements

Most themes use just a couple of templates file: archive.php, index.php, page.php, search.php, single.php. That’s it.
Well, there are many other templates that could improve the overall experience with your theme. You might want to style templates like: author.php, attachment.php, video.php, etc.

Reference: Template Hierarchy Diagram http://codex.wordpress.org/Template_Hierarchy#Visual_Overview

7. Create a Theme options (control panel) page

If you’re not using them already, let me tell you this: after you complete your first options page for your theme, you will realize how much freedom that gives you.

Some tutorials to get your started:

What tips do you have?

I would love to hear more tips from other theme developers.
What are your preferances? What do you consider “a must” for your themes?

Subscribe to the WPZOOM newsletter.

Join 50,000 people. Get our latest news & releases delivered to your inbox.

12 Comments