< terug
Pascal van GaalBackend / frontend05/05/2017

How to make a theme?

I think everybody knows themes and everybody knows where to find ‘em. But what if you’d like to make your own theme? Would you rather buy a theme and adjust everything to your needs? Or are you going to make a parent-theme for yourself in order to get the basics right?

The difference between a normal theme and and a parent theme

The main difference between a normal theme and a parent theme is that you can always update your parent theme.

Whilst using a normal theme, if you would ever consider updating, you need to check all the files, search through all your functions, styling and scripts. All the edits you make need to be found and copied into the new version of your normal theme.

You need to do this because else your client might miss parts of his or her website. And this can be a pretty time consuming process if the client has a big theme.

A couple of pros for parent theme development

One of the biggest problems I described above can easily be countered by using a parent theme.

  • You can easily update the parent theme
  • You decide all the basics for your future themes, allowing you to plan ahead.
  • You can copy a file from your parent theme, paste it in your child theme, add your adjustments and everything is good to go. (The base file in your parent theme is still intact, so you could always revert easily if something went wrong)

The bare minimum

The bare minimum for a theme are the following two files:

  • Style.css
  • Index.php

This is the bare minimum for WordPress to recognize your theme. An example for the style.css file can be found here: https://codex.wordpress.org/Theme_Development – Theme_Stylesheet

Eventually you will also need to make a couple of more files like:

  • Header.php
  • Footer.php
  • 404.php

You can basically add as many files as you want to your parent theme, but my tip would be to keep updatability in mind and keep it simple.