A child theme is a theme that inherits the functionality and styling of another theme, called the parent theme. Child themes are the recommended way of modifying and customizing Bootplate.
Already a WordPress child theme master? Download a blank child theme to get started.
Not a master WordPress child theme developer? Not a problem. Here’s a Step-by-Step Guide for building your first custom child theme.
Why use a Child Theme?
There are a few reasons why you would want to use a child theme:
- If you modify a theme directly and it is updated, then your modifications may be lost. By using a child theme you will ensure that your modifications are preserved.
- Using a child theme can speed up development time.
- Using a child theme is a great way to learn about WordPress theme development.
Template Files
If you want to change more than just the stylesheet, your child theme can override any file in the parent theme: simply include a file of the same name in the child theme directory, and it will override the equivalent file in the parent theme directory when your site loads. For instance, if you want to change the PHP code for the site header, you can include a header.php in your child theme’s directory, and that file will be used instead of the parent theme’s header.php.
You can also include files in the child theme that are not included in the parent theme. For instance, you might want to create a more specific template than is found in your parent theme, such as a template for a specific page or category archive.
See Template Hierarchy on the WordPress Codex for more information about how WordPress decides what template to use.
Using functions.php
Unlike style.css
, the functions.php
of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)
In that way, the functions.php
of a child theme provides a smart, trouble-free method of modifying the functionality of a parent theme. Say that you want to add a PHP function to your theme. The fastest way would be to open its functions.php
file and put the function there. But that’s not smart: The next time your theme is updated, your function will disappear. But there is an alternative way which is the smart way: you can create a child theme, add a functions.php
file in it, and add your function to that file. The function will do the exact same job from there too, with the advantage that it will not be affected by future updates of the parent theme.
“Pluggable” Functions
“Plugable” is nerd-speak for you can overwrite or add to these pretty easily. All Bootplate functions are wrapped in an if(!function_exists())
statement. Translation: “If a function with this exact same name does not already exist, here’s a function with that exact name. Otherwise, skip it.”
As I’m 100% sure you read the “Using function.php” section above, your child theme’s functions file gets loaded BEFORE the main one. That means, if you want to overwrite one of our functions with your own, all you have to do is copy and paste it from our bootplate/functions.php
file into your /child-theme-whatever/functions.php
file. You’re welcome.
If you have any trouble with all this functions business or need a little help understanding what our functions are doing, feel free to submit an issue on GitHub labeled “question”. We’ll either explain ourselves, or point you in the direction of the missing documentation.
All Done (for now)
Creating your first Bootplate child theme is pretty easy. You can choose from a handful of pre-built child themes we’ve done for you, or download a (mostly) blank starter child theme to get started fast.
Not a master WordPress child theme developer? Not a problem. Here’s a Step-by-Step Guide for building your first custom child theme.
At this point, you should be in pretty good shape, but let’s extend the basic functionality of Bootplate + your Child theme with plugins. We’ve got a few recommended plugins and even some that are pre-integrated.