PressTigers

How to Create WordPress Child Theme

To extend the functionality of a parent theme in WordPress, a Child Theme (also known as a secondary theme) is created. Since you can activate only one theme at a time it becomes tricky to extend the functionality of your website. For this, you can update/edit your Parent theme. However, once it is updated, all your custom modifications will be lost. But there are other ways from which you can extend/modify the functionality of your WordPress website such as:

  • Plugins – If you want to add a new module or to achieve back-end related functionality (not related to site front end design), you can configure/activate a plugin for it
  • Child Themes – You can create child theme of any Parent theme. The child theme will use 100% functionality of its parent theme while letting you can add/modify the parent theme design, etc. It also provide speedy development according to the WP standards

Steps for creating a Child Theme:

Let’s say you want to create a child theme for your theme named “PT WordPress Theme???

  1. Go to the WordPress theme folder from FTP/File Manager, and check the name of your activated theme. In our case, “ptWordPressTheme??? is the theme folder name
  2. Once you have decided on your parent theme (which is already activated) you can create a child theme for “PT WordPress Theme??? and modify this theme’s front-end design
  3. Create a new folder in the WordPress theme folder; in this case we created “ptWordPressTheme-child??? as the folder name
  4. Your child theme folder should contain at least the following two files:
    a) style.css
    b) functions.php
    If the “ptWordPressTheme-child??? folder does not contain these files you can create them, for example, as style.css and functions.php
  5. Now its time to add some code in these files – begin with style.css:
    a) Open style.css file. Add the following code and modify it according to your requirements:

    b) Here, note the template value. Ideally it should be your parent theme folder name, in order to use its functionality in the child theme
    c) Now open functions.php file. Add the following code and modify it according to your requirements:
    <pre”>

    This code will add the parent style in your theme

  6. Now you can add a new CSS or override the parent CSS in your child theme’s style.css file
  7. In the same way, you can override the parent template
  8. Don’t forget to activate your child theme – and you are done!
wp-child-theme-activation

User Comments

Leave a Reply

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

Get in Touch