Customising WordPress: Child Themes

 In Uncategorized

One of the many things I love about WordPress is the ease with which I can customise the functionality and styles to add new features to my default WordPress Installation. Over the next few weeks, I will start with a starter child theme and develop it to include a custom post type, its related taxonomies, display archives and styles for the custom post types and conclude the ‘Customising WordPress’ series with a truck load of WooCommerce customisations to allow you to implement new and interesting features on your WordPress website.

For ort example we will work with a site that provides movie reviews while categorising movies by genre and finally we will add functionality to sell those movie reviews as digital downloads and other fictional products. We will customise all aspects of the website including display, functions, customer emails and many more.

To be able to do that, we will use the most powerful tool in our arsenal, child themes. Child themes supplement the main theme or parent theme and allow us to unleash the complete power of the CMS.

Parent Theme

The parent theme in WordPress is the folder that contains all the theme files including styles, functions, display templates and all other add-ons that the publisher has included in the theme.It also contains the minimum set of files that are required to display all your content to the website visitor. By default, WordPress uses a theme dedicated to the calendar year. So the current default theme is 2022. You can download the 2022 theme here.

You can also add a theme by another developer. You can download themes for free from WordPress.org or one of the many theme developers that sell them on their own sites or theme market places such as Themeforest or TemplateMOnster among others.

Caution

You should never ever edit or try to update the code inside the parent theme for multiple reasons. The main ones for not editing the parent theme are:

  1. Everytime you update the theme, your edits will be lost.
  2. You can break the main theme causing your site to break
  3. You can accidentally create errors in the code

Child Theme

The child theme files are given higher priority in the reading order by WordPress which is what allows you to override aspects of the main theme. You can:

  • overwrite styles
  • author PHP code to add new functionality
  • create custom post types
  • add display files for the custom post types
  • add specific functions to help with your sales funnel or conversion rates
  • control the checkout and cart fields
  • customise WooCommerce product display, shop page and product categories easily
  • customise WooCommerce email templates
  • override the functions in the main theme if you might need to do so.

Things to remember

If you are going to add a child theme to customise your WordPress installation, you should do it at the very start because some of the settings dont get copied over when changing themes. For example, any menus or widgets you may have setup will not be copied over creating extra work for you to restore the menus and other features.

Basic child theme

WordPress.prg provides you with guidance on how to create a child theme. I am using the default “twentytwentytwo” theme as my parent and this child theme is based on the 2022 theme as a parent theme. You can download this very basic child theme and get started as you begin your theming journey through this series of Customsing WordPress blogs.

Conclusion

Child themes are a very powerful tool in customising WordPress and allow us to add functionality and features to our WordPress websites. This is exactly why I feel in love with WordPress as a CMS because customising is easy but you have to go about it the right way.

author avatar
Amit Wadhwa
A self-motivated problem solver, with a knack for helping people understand technical jargon I know WordPress. Over the past 15 years, I have broken it, put it back together and made it work. I am a self-taught WordPress expert. I am also the What Not To Do with WordPress" guy I have always been a determined problem solver, driven by the desire to understand why things break down. This natural curiosity has served me well over the last 15 years during which time I have looked at, browsed, studied and designed websites for a multitude of people and businesses.
Recent Posts

Leave a Comment

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Start typing and press Enter to search