Easy Child Theme Creation – A WordPress Guide

Share this post

 

Step Four: Activating Your Child Theme
Your child theme is now ready to be activated. Log in to your site’s administration panel, and go to Administration Panels > Appearance > Themes. Your child theme should be listed and ready for activation. If your WordPress installation is multi-site enabled, you may need to switch to your network administration panel to enable the theme from the Network Admin Themes Screen tab. You can then switch back to your site-specific WordPress administration panel to activate your child theme.

Note: You may need to re-save your menu (Appearance > Menus or Appearance > Customize > Menus) and theme options, including background and header images, after activating the child theme.

Additional Step: Changing Template Files
Your child theme can override any file in the parent theme. If you include a file of the same name in the child theme directory, 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.

Additional Step: Using functions.php
Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. It is loaded in addition to the parent’s functions.php file, right before the parent file loads.

The functions.php of a child theme provides a smart, trouble-free method of modifying the functionality of a parent theme. If you modify the parent theme’s functions.php file, your function will disappear the next time you update your theme.

If you add a functions.php file to your child theme and add your function to that file, the function will do the exact same job from there, with the advantage that future updates of the parent theme will not affect it. Do not copy the full content of functions.php of the parent theme into functions.php in the child theme.

The structure of functions.php is simple: An opening PHP tag at the top and your bits of PHP below. You can put as many or as few functions as you wish. The example below shows an elementary functions.php file that does one simple thing: adds a favicon link to the head element of HTML pages.

' . "\n";
}
add_action( 'wp_head', 'favicon_link' );

Related Posts

15 comments

This is great information for anyone who has a WordPress site. I have found that many people who design their own websites, myself included, fail to create a child theme when they initially build their site.

We all learn our lesson the first time we hit that update button and loose hours of hard work and special coding. Thank you XterraWeb for taking the time to research this issue and provide us with so many different choices. I’m definitely going to take advantage of your insight.

Amor Libris (Kelly Hartigan)

Thank you, Melanie. I learned that lesson too. I was new to WordPress and didn’t learn about child themes until after I had made multiple changes. I wish I had known about this before. Unfortunately, once you have made multiple modifications to your WordPress parent theme, things become a bit more challenging. I was about to give up until I conducted some research and discovered I could make the process a bit easier with the exception of dealing with the functions.php file. I hope the information in this article helps make the process less challenging for you.

A wonderful insight into the possibilities but I dont’ think I’ll be going there anytime soon.
Simply using my WordPress site as it comes is enough for me. I find it time-consuming to get posts, menus and sidebars as I want them without digging into the minefield you’ve explored in depth.
Kudos to you guys who are capable of such technical wizardry. 🙂

Amor Libris (Kelly Hartigan)

Thank you, Tom. Yes, this is a bit more advanced. However, if someone just created a self-hosted WordPress site, the plugins to create the child theme would be helpful, easy to use, and save them from encountering problems in the future.

This is SO helpful! Most people have WordPress sites and would have no idea about these tips that could save them heartache in the future.

Well this blog article was not what I was expecting but everything I needed to read about! I may switch to WordPress one day and will try this.

Thanks for all the info – at the moment I’m just using a free WordPress theme for my blog, but I know at some point I’ll want to upgrade to something I have more control over. You’ve explained all the options in a really easy way – pinned for when I take the next step in blogging!

This is really useful thanks for sharing. I sometimes struggle to figure out child seems so I will be bookmarking is page.

A helpful post – not come across child theme before.I don’t have a wordpress blog anymore though! Look forward to more helpful reads 🙂

This is great information for someone starting their own blog! I wish I had a post like this to read when I switched over!

Child Themes are great. I’m currently working on mine so this was a great help.

Very informative! I am not on wordpress and have not made the switch but will be bookmarking this if ever I do.

been looking for a friendly guide for wordpress users lately! this will be a big help for me! thanks for posting it!

At the moment I’m using a free WordPress theme but I hope to switch this up soon. Your explanation is one of the clearest I’ve seen – child themes have had me confused for a long time. Thanks for explaining it in such an easy way to understand.

Very good information. When I was looking for a new theme, I saw child themes and didn’t understand what it was.