7 Easy Tips to Create Better WordPress Themes

Developing a WordPress theme is a complex task. We need to create a system which can handle a lot of content in a well-styled manner in any situation.

We have to meet coding standards, and we have to support a bunch of plugins. The tasks sometimes are infinite.

Lately, I am developing a more straightforward WP theme (named Alpha) to submit into the official theme repository. So I have some wisdom to share with you if you are interested in making better WordPress themes!

Pine’s first WordPress theme named Alpha. (Work in progress…)

Learn From Other Themes

A good tactic if you dig through the popular theme’s functions and code. Go the official repo and filter the popular ones, download it and start to explore. Check out what they can do and how!

In this way, you can learn a lot from not just the theme development but about other developer’s thinking. Downloading the new native theme (twentysomething) is a must. These are high-quality themes where you can find the latest features too (like I found the starter-content method).

For me, the most exciting part was the option and customizer frameworks. These two can help you a lot but there too many of them. Choosing one is hard and critical for future development. So I read through some source code and found the bests for me.

Use a WordPress Theme Starter or Framework

If you develop more than one theme, you should use some WordPress theme framework (it can be your own or can be community developed).

I’m not a big supporter of the bloated systems, so I get with _s which a lean starter theme. For me, it is more than ideal.

Pick one which is the best for you and works well there are a lot of them to choose from. Be cautious about the support and try to find a well-documented and secure system.

Start With Full Test Content

One of the first steps of the development should be the adding of the test content. The Theme Unit Test is a great starting point which helps you find the unformatted elements and the bugs.

Note that now we have Gutenberg which required more from the theme developers. Fortunately styling the default blocks is as easy as in the case of TinyMCE but it can be tricky. To generate test content check the Block Unit Test for Gutenberg plugin!

Add Less Feature

This step is almost always correct. If you want to make a remarkable piece of code, you must have to make it as smooth and light as possible.

More feature doesn’t mean better themes. Sure you can create multi-purpose themes, but in my opinion, the users don’t need 100+ Google Font. Not to mention that it is impossible to optimize your design for a lot of fonts because every one of them is different in some way.

With every newly added feature, you add complexity to your theme although – mostly – it does not give so much value to it. It makes your work harder, your code less maintainable and of course it can make the overall performance worse.

Next time you start to develop a theme not just think about the features that can be added but the ones which can be removed.

Reach Out For Dependencies

Developing a great theme without any dependencies is possible but hard. For me, the two necessary ones were the Kirki and CMB2 plugin. I build on the top of these great extensions of Alpha’s main features.

To require them I used the TGM Plugin Activation where I also set up recommendations too like Yoast SEO and Jetpack which features are also supported in the theme but not needed for the run.

Another dependency is WPGulp which is needed for the development tasks. It is easy to use and a fantastic tool optimized for WordPress development!

Using well-supported dependencies is advantageous. We can focus on other tasks, and the extensions are always up to date because of some great developer.

Test your theme like never before

The Theme Check plugin is the first step to submit a theme to wordpress.org. This plugin runs your code against thousand of tests if it passes then right, if not correct the mistakes and measures the recommendations.

Cross browser testing should also be a default. The newest browsers quite goods but still can be problems in some cases especially if you use more modern techniques like CSS Grid.

If you can give your theme test to other people too. You see your project all the time, and after a while, you can’t notice the bugs.

Make Great Starter Content

To show the theme’s real potential, you should include starter content. From version 4.7 WordPress support a native way to present – in the Customizer – and after a save to show it live.

I wrote about it previously, check it out!