Getting Started With WordPress Theme Development

Why WordPress Theme Development?

WordPress is the most popular CMS currently available, so if you want exposure for your project why wouldn’t you develop it in WordPress. If you already know Java, HTML and CSS and already use those skills to make websites then WordPress could be the next logic step.

While knowing PHP is a bonus it is not actually required to build a WordPress theme. If you have some Bootstrap skills that can give you are slight advantage but once again it is not necessary. it is not to difficult to build a custom WordPress theme from scratch.

What is a WordPress Theme?

A WordPress theme is basically a template that changes the look of your website. Modifying the theme changes the look of your site externally but the way the back-end operates generally doesn’t change. This means that webmasters can move between WordPress sites without needing any extra training or knowledge to operate them. Yet the sites can all look differently. You can check out thousands of free WordPress themes at WordPress.org or premium Themes at Themeforest.net. If you have seen a site that you think looks interesting you can check it out with WP Theme Detector. You will be pointed at the theme.

Most developers don’t realize but you really only need two files to make a WordPress theme.

  1. index.php – the main template file
  2. style.css – the main style file

While this is strictly true, a developer who sticks to just these 2 files will usually end up with functional but quite basic theme.

GNU General Public License WordPressBefore we start we would like to mention the GNU General Public License (GPL). All WordPress themes are governed under this licence whether they are free or premium. The GPL four basic freedoms.

  1. Freedom to run the program for any purpose.
  2. Freedom to study how the program works and to change it, so it performs computing as you wish.
  3. Freedom to redistribute copies, so you can help your neighbor.
  4. Freedom to distribute copies of your modified versions, giving the community a chance to benefit from your changes.

However if you do not plan to distribute the theme then you will not have to adopt the GPL licence.

Set Up a Local Development Environment

Try to make sure the local development environment is identical to the final destination production server. A local development environment is preferable for a few reasons.

  1. Speed of development.
  2. Testing is easier.
  3. lack of internet connection will not hamper development.
We recommend your local development environment be made up of.
  1. Linux, Ubuntu or (if you really have to) Windows
  2. Apache or Nginx
  3. MySQL or MariaDB
  4. PHP
  5. A good text editor (we recommend Notepad++ or PhpStorm)

External WordPress Development Tools

You will need an internet connection for these but we are assuming that eventually you will want to upload your theme anyway.

  1. A good introduction to WordPress debugging https://nacin.com/2010/04/23/5-ways-to-debug-wordpress/
  2. WordPress.org Theme Unit Test Data is an XML file containing dummy test data that you can upload to test how themes perform with different types and layouts of content.
  3. Debug Bar is a plugin that provides debugging in the WordPress admin area.

There are other tools but these 3 are a good start.

Where to Start?

We recommend that you start by looking at some of the default themes that come with WordPress. At this point I have to come clean about something. I have never actually started a WordPress theme from scratch. I have always started with a default theme and modified from there. These days I have highly modified and unrecognisable versions of default themes that are my starting point for new projects. I figure why reinvent the wheel. A great way to start is download one of the themes listed below and just start hacking.

Here is a list of default themes.

If you are an experienced developer and don’t want to deal with inbuilt biases in the above listed themes then a great way to start is to generate your self an underscore theme. Just navigate to Underscores’ website and enter a name for your theme. You will be prompted to download a skeleton for a WordPress theme.

Upload the theme to /wp-content/themes in your WordPress installation. You can now start tinkering with the look and feel of your Theme.

This is just a quick starter guide and not meant to be an in-depth expert instructional on how to make a WordPress theme. Stay tuned that article is coming.