Customising Themes

The obvious way of customising a theme is by simply modifying the theme’s files directly or by adding code to it’s functions.php file. This is not a good idea because each time we release an update for the theme, your will lose all your changes and have to start over.

Fortunately, there are several ways of extending a theme without touching any of its files and therefore being able to upgrade without hassles.

Overwriting Template files

The first way is by creating a child theme.

The main idea is this: when you create a file in the directory of the child theme, you overwrite the corresponding file in the parent theme.

So, for example, if you create a single.php file in your child theme, WordPress will use that, instead of single.php from the parent theme.

Pluggable Functions

Child themes have a special file called functions.php. When you create a functions.php file in your child theme, WordPress will load it and then also load functions.php from the parent theme.

Because of this, it’s possible to define functions in the parent theme which can be overwritten by defining them in the child theme’s functions.php file.

This is described in more detail in the second part of the child themes tutorial.

The main disadvantage of this approach is that it’s all or nothing: once you define your own function, you no longer have access to the original function.

Actions And Filters

The final and most powerful way of changing the behavior of a theme is by using actions and filters (collectively known as ‘hooks’). These can live either in a child theme’s functions.php or in a plugin file.

Your rating: none
Rating: 4.2 - 12 votes

Popular Add-ons

Profiler for Vantage

Adds a one page author website to your Vantage theme.


(6)
$39

Fortumo SMS payment gateway

Fortumo sms payment gateway for ClassiPress


(3)
$39

Bazar

A Stunning Child Theme for Classipress 4


(11)
$49