8 bad practices of WordPress theme development

24 Dec 2015August InfotechDevelopment, WordPress

Imagine this – you’ve created a new theme and are keen on getting feedback and even thinking about putting it in the market. As luck would have it, one of your clients needs a similar theme. You sent them a demo link and they love it. A few tweaks and you’ve made an expected sale.

Excited and confident about approval, you send the theme to a reputed marketplace. The theme doesn’t make the cut. If you’re wondering why, then read on –

Implementing a theme for your client and one for the marketplace are two different things. When you implement theme for sale, you have to consider ease-of-use, coding standards, documentation, compatibility and do all this for buyers from across the globe. If you don’t follow best practices for WordPress theme development, then your theme is bound to get rejected by marketplaces, even though, it has right aesthetics and eye catchy design elements.

Bad practices to avoid in order to implement a great theme:

1.Lost in Translation

As WordPress is widely used even in countries where English is not a native language, people prefer a translatable or multilingual theme. If you implement a theme which can’t be translated into local language, then you’re not targeting a significant number of users. If it isn’t possible for you to provide a theme in multiple languages, at least provide a translatable one which end users can localize on their own. For more details on how to implement translatable theme, kindly check out localization section on WordPress.org.

2.Poor Coding Standards

When you develop code to sell, you have to make the code understandable. WordPress Codex provides universal standards for coding and helps theme developers follow same coding style. All major theme marketplaces require developers to follow coding standards while creating themes.

WordPress theme is mainly comprised of HTML, CSS, JavaScript PHP code and guidelines are provided for these four languages on WordPress.org. Use these guideline links:

This does involve a lot of work, but gets easier with practice and more importantly, pays off monetarily in the long run. If you've followed best practices for said theme, then it's less likely to conflict with other plugins, saving you from dealing with more support tickets from users.

3.Improperly Commented Code

When you develop theme for marketplace, don't forget that your theme will be used by hundreds or thousands of developers. You're probably aware of the fact that in software life cycle, code is written 20% of time and referred by other developers 80% of the time. If you haven’t properly commented your theme code, then users will have a hard time understanding your code.

When in doubt, refer to these links for PHP and CSS code commenting guidelines provided by WordPress.

For HTML and JavaScript, there is no recommended way for commenting. You have to be clear and precise with the code and simply add comments where needed.

4.Reinventing the Wheel

WordPress community is vast and you'll find plenty of free plugins for the some of the functionalities required by your theme. Instead of developing everything from scratch, utilize free plugins from reliable sources with appropriate licences. For example, if you are working on developing premium WordPress magazine theme, then don't waste your time in developing features for magazine. Search for some good plugin from WordPress.org instead and develop your theme around it.

You'll find an extensive library for jQuery plugins. Use those plugins to achieve some of the features of your theme like sliders, accordions, tabs, etc.

5.Entering Plugin Territory

WordPress rule of thumb - if a feature is about visual appearance of the website, then incorporate it in a theme and if, it's about functionality of a website, define it and add as a plugin. If you're developing a theme for publishing issue based magazine, then use a plugin which includes creation of custom post types and taxonomis to generate the content. The theme will automatically present this content on website. When users change the theme, they won't end up losing theme data.

6.Offering Too Many Features

Do not offer every feature under the sun in your theme, as you can't possibly implement a single theme that's suitable for everybody. Instead focus on a niche topic and implement themes with realistic and useful features for that industry. Themes with just the required features and shortcodes are more user friendly.

7.Not Organizing and Optimizing Files

If you are implementing theme for marketplace, your theme will be used by many developers. Make sure you organize theme files following WordPress guidelines. Check provided links for themes file organization:

Along with organized files, optimization is also important. Your theme should load faster and theme code should be optimized. A theme implemented on niche topic with optimized code is smaller in size, reduced to a few MB, which makes it very user friendly.

8.Not Validating and Testing Your Theme

Not checking your completed work is the biggest blooper. Once you are finished with theme development, check your work using online tools.Try to use and check your theme as a prospective buyer.

Refer to Testing section of Theme Handbook on WordPress.org. There you'll find available tools to check your theme along with all the points you have to consider. Use popular plugins like WPML, BuddyPress and WooCommerce to check your theme.

Avoid these bad practices and develop a theme perfect for both marketplace and users.

Do you think there can be more?

Don’t forget to post your suggestion as a comment.

Originally posted on IssueMagazinePlus.

Free Quote & Consultation