WordPress theme development

Things to know before Developing a WordPress Theme

Hello friends, in this post we just know about the things that should one keep in his mind before jumping to theme development. WordPress theme is not just a simple HTML packed code, it more than that. So, let get the start.

Use validated HTML Template

The first thing you need is an HTML template. On which you create the theme. The HTML template should be well designed. Not having JS related issue. HTML should be as per w3c validator. Not using the restricted class names like post, page, category etc. As WordPress is a dynamic system so it generates these classes in theme. If you are using these class names in HTML, will bother you later.

Linking CSS and JS file at proper position

If you are using any type of CSS framework or predefined CSS in your theme. Then it must be called before your custom CSS. WordPress calls CSS via their ID, that we provide while coding. If you are using same ID name for two different CSS files. Then last in the code will be called. One more very important thing, if you are using framework CSS or JS then provide their proper ID.

wp_enqueue_style(‘bootstrap’, get_stylesheet_directory_uri(). ‘/css/bootstrap.min.css’);

in above piece of code, we provide bootstrap as ID for bootstrap.min CSS file. If you using this with your own ID and the same file is used by a plugin. Then both of the files will be linked. Which is not a good way. It will increase site loading time, reduce speed etc. If proper ID is given then only one file is linked.

Must provide 404 page and Content not found section

While developing any one only pays attention to visible content. So sometimes 404 and content not found the page is missed. Which is very important for a good theme. If somebody makes error In URL then 404 error will occur. While searching something that is not on site then content not found section will be helpful.

Provide proper theme tags and description

Proper theme tags and description make the user to get what he can find in your theme. It reveals whether your theme support 2-column or 3-column layout. Support threaded comments or not. Featured image function is available or not. And description let user about your theme.

Make theme translatable

WordPress provides a very simple method to make the theme translatable. And anyone can use your theme. If a site is Multilanguage then every text uses in the theme should be translatable. For this, we have to define a theme text-domain as per theme name.

load_theme_textdomain( ‘theme-name’, get_template_directory() . ‘/languages’ );

After defining theme text-domain, use it everywhere where you are using custom text in the theme. Custom text should be used with proper gettext functions, like __(), _e() etc.

Support Right to Left

Many of languages are written in reverse order, Right to Left. So theme should support right-to-left (RTL) format. Right-to-Left is 100% CSS work. So don’t worry if your HTML is not having Right-to-Left CSS. I will post a tutorial for this.

Should have a proper screenshot

Adding a screenshot image is mandatory. It let the user know about your theme’s design without installing the theme.  So proper screenshot image should be in theme.

Adding readme file

Reading file tell the user about theme’s update. What’s new is added in theme. Which framework files used by the theme. Speak about the license of the theme.

That’s all things that one should know before diving into theme development.

Subscribe to this blog to get latest post direct into your inbox.

Share the Article

About author
Darshan Saroya

Darshan Saroya

A passionate WordPress Theme Developer. I love to create clean and modern themes, using the power of WordPress. Here I provide the tutorials related to WordPress Development, Core PHP and HTML.