Top Left Text cha

Web & App Development

The WordPress Codex kind of complicates things when it comes to creating a child theme.   It's actually very easy as long as the parent theme 'plays nice'.  You can read the long, complex version here if you want.

Here's the Simple Instructions

For ease of explanation, I'll call my template 'template'. So it would be located at /wp-content/themes/template/.

  • Create a new folder inside the themes folder called /template-child/
  • Inside that folder, create a style sheet called style.css (at /wp-content/themes/template-child/style.css)
  • Inside that file, paste the following code:
    /*
     Theme Name:   Template Child
     Theme URI:    http://mywebsite.com/template-child/
     Description:  Child Theme for Template
     Template:     template
    */

    The only important line in there is 'Template:'. It should be the same as the name of the folder of your parent theme... in this case, it would be 'template'.
  • Create another file inside the child theme folder called 'functions.php' (at /wp-content/themes/template-child/functions.php)
  • Inside the functions.php file, paste the following code:
    <?php
    add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
    function enqueue_parent_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }

     

  • Go into the WordPress Administration, click on 'appearence' then 'themes' and select the new child theme you've created and uploaded.
Should be good to go.  Any template files you want to edit now, you can just copy and paste it inside the child theme folder (like header.php or front-page.php) and edit away.

Add comment


Security code
Refresh

  • No comments found

Leave your comments

Post comment as a guest

0
Your comments are subjected to administrator's moderation.
X