+254725682556 +254725052660 info@ziprof.co.ke
Client Area

WordPress

How to Create and Use a WordPress Child Theme

A WordPress child theme is a small theme that inherits everything from your main ("parent") theme but keeps your own customizations in a separate place. If you've ever edited a theme's files directly and then lost those changes the next time the theme updated, a child theme solves that problem for good.

What Is a Child Theme?

A child theme is a real theme in its own right: it has its own folder inside wp-content/themes, its own style sheet, and (optionally) its own functions file. WordPress loads the parent theme's templates and styles first, then layers your child theme's changes on top. When the parent theme releases an update, WordPress replaces the parent theme's files but leaves your child theme completely untouched, so your customizations survive.

Editing a theme's files directly (without a child theme) is risky: the next update to that theme will overwrite your changes without warning.

Before You Start

  • Know the exact folder name of your current ("parent") theme. You can find it under Appearance > Themes in your WordPress admin dashboard.
  • Have a way to create files: either the File Manager in your hosting control panel, or an FTP/SFTP client.
  • Take a full backup of your site first, so you have something to roll back to if anything goes wrong.

How to Create a Child Theme

  1. Log in to your hosting control panel and open File Manager, then browse to wp-content/themes (or connect via FTP/SFTP and go to the same folder).
  2. Create a new folder here and name it after your parent theme with "-child" added, for example yourtheme-child.
  3. Inside that new folder, create a file named style.css and add a header comment like this at the very top:
    /*
     Theme Name: Your Theme Child
     Template: yourtheme
    */
    The Template line must exactly match the folder name of your parent theme, in lowercase, or WordPress won't recognize the connection.
  4. In the same folder, create a file named functions.php and add this so the child theme loads the parent theme's styles correctly:
    <?php
    add_action( 'wp_enqueue_scripts', function() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    });

Activating Your Child Theme

  1. In your WordPress admin dashboard, go to Appearance > Themes.
  2. Your new child theme should now appear as a theme option (it may show a plain preview since you haven't added any custom styling yet). Hover over it and click Activate.
  3. Visit your website to confirm it looks the same as before. If the styling looks broken, double-check the Template line in your style.css matches the parent theme's folder name exactly.

Making Customizations

Once your child theme is active, you can safely make changes without touching the parent theme:

  • Add your own CSS rules to the child theme's style.css to override the parent theme's appearance.
  • Copy a specific template file (like header.php or a page template) from the parent theme into the child theme folder, then edit that copy. WordPress will automatically use your child theme's version instead of the parent's.
  • Add small custom functions or code snippets to the child theme's functions.php, below the code from the steps above.
Test any changes on a staging copy of your site first if you have one available, especially before editing template files. A syntax error in functions.php can take your whole site down until it's fixed.

Because your customizations now live entirely inside the child theme's folder, you can update the parent theme whenever a new version is released without losing any of your work. See How to Update WordPress Core, Themes, and Plugins Safely for how to do that update safely.