How to add Child Theme Support in WordPress Theme

WordPress Theme is actually a collection of files that creates a layout for website content. In order to enhance the functionality of a Parent Theme, WordPress has already provided a feature to build Child Theme. This article is dependent on your knowledge of theme development, since it includes the method to add support in WordPress Theme in order to add content using Child Theme.

Let’s say you want to add a slogan in header of your website. You either have to re-locate header.php file in child theme or change parent theme’s header file (although this is not a recommended approach because it will be lost once you update the parent theme). If your parent theme provides proper support, you can do that by just writing a function and attach it using WordPress hooks.

To add slogan in header, we won’t recommend you to write a complete header.php file. Let’s assume that you already have a header.php file in your theme. At the end of this file, just add the following single call of WordPress action:

Now using the child theme, go to functions.php file and put the following code to show the slogan in header of your website:

After that, you have to write action call to attach this function to hook called in header.php that is:

You can repeat the same procedure to add more content in your header. For more details about the use of “add_action” or “do_action“, read the documentation on WordPress Codex.

User Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

    Get in Touch