Advertisement
Tips

How Compatible Is Your Theme With WordPress?

by

When using WordPress themes, the compatibility and security of the scripts are sometimes taken for granted and ignored by a lot of people. But how sure are you that your third party scripts are compatible 100% with WordPress and secure, with no holes that might expose you?

But what does being compatible with WordPress mean? Aren't all themes compatible because they work once installed? How can I check if I am using badly written scripts?

We are going to try in this quick tip to cover some of these answers and help you understand how to check your WordPress website for weaknesses and loose ends because of the plugins or themes you are using.

Note: This quick tip is also addressed to developers that are writing WordPress plugins or themes.


Checking for Compatibility, Fast and Easy

Before we look into a slightly detailed idea of how to check your theme compatibility with WordPress, we are going to look at a very easy way to identify any bugs, deprecated functions or other incompatibilities your theme might suffer from.

Use Free Plugins!

"All of these plugins are used by the theme review team on WordPress.org"

There are three free plugins that you can use in order to check your theme's code compatibility with WordPress and to look for any bugs you might have missed:

Theme-Check

A free plugin used mostly by developers, that helps you check if your theme is compatible with all the latest WordPress standards. This plugin, just like the other two, is used by the WordPress.org Theme Review Team in reviewing the submitted themes on WordPress.org. Among its features it also has the option of enabling Trac formatting so the error messages can be just copied and pasted directly into a Trac ticket for the theme (for those using Trac for feedback on code, this is a good feature).

Log Deprecated Notices

This plugin, also free, also from WordPress.org and also for developers, it is an incredibly useful plugin for checking deprecated functions, files and function arguments that the active theme might be using. This allows you to make sure you are using all the newest WordPress core functionality of your current installed version. Even more helpful, it logs incorrect function usage for all WordPress 3.1+ installations.

Debogger

This one's cool and useful. It not only does an extensive debugging of your theme and outputs the result in your footer but also checks the current loaded page to see if it validates.

So there you have it, everything you need to easily get started on theme development if you are a developer or just to check your currently installed theme for compatibility, you just install these plugins and have fun watching your theme react. I'm not going to go into detail with the functionality of each plugin as there is no point in that for the purpose of this tutorial.


A Little More Technical

In this part we are going to take a look at what to look for and check when building a theme so that you might get a lower error count in your logs when checking the final result with the previous plugins.

Say "No" to Deprecated Functions

Sometimes you just are used to doing stuff a certain way, other times you find an online tutorial that has exactly what you need and you don't know that it might be outdated, or maybe you just search for how to code something in your theme and you don't notice that the function even though it is in the codex and is well documented, it is deprecated and there's another way to achieve your goal, a more compatible way.

How do you know the function you want to use is deprecated? Well, the most obvious and quick way, if you check the codex for it, you will notice a big red colored text message telling you it's deprecated on the top of the page like in the next example picture:

There are many deprecated functions in WordPress, if you want a complete updated list of all of the deprecated functions, you can find it on the Deprecated Functions page of the Codex.

Code Quality and Integration

This part is mostly for developers. No matter what you are doing, you must do it right, and here I am referring to using the right code in the right place. If you want a category, tag, comment section, date, author etc. elements integrated into your theme for example, make sure you are using the best approach that you can use by doing this in WordPress. Don't re-invent the wheel, try to find out how something is done and do it the right way, and most importantly watch out for easy integrations like script and style registering and enqueueing, generating URLs to your theme, working with files, pictures and data from the database. WordPress has all the tools you need to help you do most, if not all, of your required theme functionality.

These are just a few examples of approaches you need to look out for when coding. There are plenty.

Header, Footer, Sidebar

Some things might seem to work at the beginning but if they are not implemented correctly, they will not work. The most important aspect of this idea in a theme's functionality are the header.php, footer.php, and to a lesser extent sidebar.php files, that are the default header, footer and sidebar files that you normally include into your theme code. Getting to the point, if these files are not implemented correctly, your theme will not be compatible with WordPress at all, as there is necessary core functionality happening inside these files. When and if you get errors from the plugins we mentioned at the beginning, you might find your missing or bad code in one of these files.

Functions.php

The most important file in any WordPress theme, as it is the file that holds all the main code core functionality. This is the place where everything happens, the bakery, the "source". Here, you run all your hooks, register your scripts, create the widgets, implement everything and anything you might require in your theme. So I think it's safe to say it's the number one place to look for errors when they turn up.

Core Features

WordPress has a number of functions that you might want to include in your website where they should be included.

That's a little vague, isn't it? Let's look at an example: if your websites has a blog version, and you want that blog to have all the flexibility and compatibility with WordPress, and most if not all plugins, you might want to make sure you integrate with the functionality generating that page the core features needed by WordPress or the plugins to do their magic. Things like integrating the sidebar properly, the comments section, writing the loop correctly and even generating the header and footer files is a very important part of the compatibility you should be looking for.


Conclusion?

WordPress development has some rules and approaches, make sure you know what they are when implementing anything and make sure you are not missing something important that might make your theme incompatible or insecure. Don't forget to test, re-check and stay up to date with all the updates that the new WordPress versions bring.

Related Posts
  • Code
    Articles
    Introduction to WordPress App ThemesApp theme 400
    With the increasing growth rate of WordPress powered websites, the need for WordPress themes is rising. Multi-purpose themes are becoming highly popular among website owners. Many existing themes are built mainly to address blog functionality. But with the growth of WordPress web application development, we are in need of specialized themes for different purposes. These themes are known as app themes. In this article, we going to familiarize with the concept of app themes and their usage in real world.Read More…
  • Code
    Plugins
    Choosing the Right Plugin for Your Next WordPress ProjectPlugin icon 400
    Ever needed a plugin for your WordPress-based website? Of course! After all, that's how WordPress is extended, isn't it? If you're a beginner to WordPress, or even a power user, then you're likely familiar with the WordPress plugin repository, premium plugins, and so on. The thing is, there are so many plugins available that do many of the same things, it can be difficult to determine which is best suited for your particular needs. This raises the question: What do you do to find the perfect plugin for a particular need? In this post, we're going to see how to find the best plugin for exactly that.Read More…
  • Code
    Theme Development
    Creating a WordPress Theme From Static HTML: Releasing Your ThemeCreating wordpress theme from html 400
    If you've been following this series you now have a working WordPress theme. Your theme has a number of template files, including a page template and an archive template, and also has featured image support.Read More…
  • Code
    Theme Development
    Creating a WordPress Theme from Static HTML - Creating a Page TemplateCreating wordpress theme from html 400
    So far in this series, I've shown you how to create a fully functioning WordPress theme from static HTML. We've covered the following steps: preparing your markup for WordPress converting your HTML to PHP and splitting your file into template files editing the stylesheet and uploading your theme to WordPress adding a loop to your index file adding meta tags, the wp_head hook and the site title and description to your header file adding a navigation menu adding widget areas to the header and sidebar adding widget areas, a colophon and the wp_footer hook to the footer file. At the moment, your theme only has one template file for displaying content—the index.php file. A powerful feature of WordPress is the ability to use template files for different kinds of content.Read More…
  • Code
    Theme Development
    Making the Perfect WordPress Theme: Maintenance, Compatibility, and Customer CareWp white 400
    In the previous part of this series, we reviewed what to avoid when making a WordPress theme. It is an important article because it's really easy to make those mistakes. And in this article, we're going to go through the things we need to do after making our theme.Read More…
  • Code
    Theme Development
    How to Customize Theme Check for Validating WordPress ThemesTheme check
    Security and consistency are some of the major concerns we have in using third party libraries, frameworks and plugins. We face the same problem in using free and commercial WordPress themes and plugins. The WordPress Codex provides a set of guidelines and rules for developing themes. In order to submit themes to the WordPress theme directory, you have to adhere to those guidelines. But there are hundreds of free and commercial themes which might not be developed according to these guidelines.Read More…