Tips to Create High Quality WordPress Themes

Every week, more than hundreds of new WordPress themes are released. Unfortunately, some of them lack quality: Bad or bloated code, not to programming standards, and so on. Here I have provided a list of 10 tips every WordPress theme developer should have it mind to create top-notch quality themes.

(1)Respect HTML and CSS standards

This may sound pretty obvious, but actually many of the themes that are publicly available  don’t pass W3C HTML or CSS validation. When building a theme, it is good to respect HTML and CSS standards. A validated HTML/CSS theme is also a proof of quality development.

Using W3C website you can check HTML, XHTML and HTML5 code.  TO check your CSS coding, W3C provides a free tool. Although with the rise of CSS3 and its vendor prefixes, it is quite difficult to get a 100% valid style sheet.

(2) Respect WordPress coding standards

Like most other open-source projects, WordPress has its own list of coding standards. This WordPress coding style convention is to keep harmony among the thousands of WordPress themes and WordPress plugins available and to have a consistent style so that the code can be clean and easy to read.

For example, the coding convention of WordPress does not recommend to use PHP shorthand tag:

<? … ?>

<?=$var?>

 

Instead, it uses the complete  PHP tags:

<?php $var; ?>

 

The complete coding standard guide is given in the WordPress codex.

(3) Don’t forget wp_head()

In most of the WordPress themes within the <head> and </head> tags, you will find a function named wp_head(). This function may look useless and unnecessary to newcomers, but it is of utmost important: Many WordPress plugins use this function to “hook” code in WordPress header. You have to note that without this wp_head() function within your <head> and </head> tags, lots of plugins will not be able to work.

 

(4)Be careful when including hacks

You might have used Hacks on your own theme, or on a client theme, but it is not good to include hacks  in a theme which you are going to distribute unless you know what you are oing to do exactly.

(5) Start from something solid

In order to save time, most developers prefer to start the coding from an existing theme. If you are looking for a rock solid basis to create your theme, then you can start from Constellation: It is a “blank” HTML5/CSS3 theme, from which the current CatsWhoCode theme is derived from.

(6)Use localized strings

When coding a WordPress theme or plugin, you have to consider about the people who do not speak English.  Using two useful functions _e() and _() you can create a translatable theme or plugin using PHP  language.

The first is the function _e(), which prints on screen the desired text, translated into the user language:

_e(“Text to translate”, “text domain”);

The second function  is _() which is same as _e() but returns the  text

 

The second is __() wich is basically the same than _e(), but returns the text:

 

function say_something() {

return_(“Text to translate”, “text domain”);

}

These functions make your work translatable and it is a great thing for people blogging in another language other than English.

 

(7) Prefix your php functions

Prefixing the php functions is always a good practice. Most of the people would name their functions using common names such as display_stuff(). Suppose a theme developer named one of his functions with the same name that a function from a plugin the end user is using… then the  site is broken, and the user feels bad.

Avoid naming your functions like this:

Function display_stuff($stuff) {

}

Instead of that you can add a prefix such as your initials:

function rjr_display_stuff($stuff){

}

It does not require much effort and it can avoid big problems for the non tech-savvy user.

(9) Test your content format

A blog is used to display the content. To make users to be happy with your theme, you should make sure that all the HTML elements look good. For that, you can use a plugin named WP Dummy Content, which allows you to create posts, pages, categories and more so that you can check how good your WordPress theme looks when it’s full of content.

(10) Let  your WordPress theme supports the latest functions

Do you think that your theme is ready for public distribution? If you say yes, then you should always make a final checking using the Theme-Check plugin, which is an easy way to test your theme and make sure it is up to the specification with the latest theme review standards.

Release your theme as GPL

With the booming of WordPress, people started creating  and selling “premium” WordPress themes. WordPress team has stated numerous times that themes have to be GPL compliant.

Most of the WordPress themes are released under the terms of the GPL licence, but several theme vendors have chosen to go with a licence that may, in their opinion, give them a better protection against piracy. Trying to release a theme which is not GPL compliant will bring complications, and might even get you a lawsuit. So it is good to respect WordPress licence.

Processing your request, Please wait....

Leave a Reply