Learning how to develop WordPress themes and plugins is an exciting and adventurous journey for any WordPress developer. In each stage of the process, you get discover new, exciting, and powerful features of WordPress.
Setting up a good WordPress development environment will go a long way to assist you when coding either a new WordPress theme or plugin. In this first part of the series, we will set up an environment that will aid us in having the a solid experience when building themes. In subsequent parts of the series, we will review the recommended plugins and significant role each plays.
Before we begin I'll assume the following;
The first plugin that I highly recommend when setting up development environment is the developer plugin. It basically provides links of all the plugins will require along with additional settings that are key for any WordPress development environment.
Login to your WordPress dashboard and then click to install the developer plugin you have just downloaded from the WordPress plugin repository.
Once you finished installing and activating the plugin, you will be prompted to choose a development environment depending on the type of project you want to work on.
In this case, I selected a theme for a self-hosted WordPress installation.
Once you click Save Changes on the previous step, a list of recommended plugins will be shown on screen. Click to install each of the plugins mentioned, but do not activate them.
We are almost done installing the WordPress developer plugin. As I mentioned earlier, the best thing about this particular plugin, is the fact that not only does it give us a list of recommended plugins, it also recommends additional settings to optimize our development environment.
Before you start working on any theme, you need to enable the debug mode on your WordPress configuration file. When you browse the
wp-config.php file, you will come across a section that looks like this:
By editing this file and inserting the following line of code
define('SAVEQUERIES', true);, debug mode will be enabled, allowing you to see notices during theme development in case of any errors. The
SAVEQUERIES definition saves the database queries to an array and that array can be displayed to help analyze those queries. The array will be displayed by installing a plugin, that will do on the next part of this series.
Take note that
SAVEQUERIES will have a performance impact on your site, so make sure to turn this off when you aren't debugging.
In this article, we setup the Developer Plugin and prepared our WordPress environment to ready itself for development. We looked at tools and strategies that help us to do a better job of catching warnings, errors, and notices.
If you have any questions or comments about anything covered here, please leave a comment below!