Web Design, SEO & Online Marketing
  • BLOG
  • CONTACT

Hamza Shatela

Join WP 1 Year Program
  • Home
  • Blog
  • WordPress
  • How to Create a WordPress Child Theme
July 10, 2018

How to Create a WordPress Child Theme

How to Create a WordPress Child Theme

by Shatela Hamza / Monday, 13 November 2017 / Published in WordPress
How to Create a WordPress Child Theme

WordPress does make it really easily to completely customize a website theme, but how do you protect your adjustments from being overridden by the theme provider on the next update? In this tutorial, we will go over how to create and use child themes, and why using them is so important. You will need to have a bit of knowledge of HTMl, CSS and/or PHP.

  1. Why you need a child theme?
  2. How to create a child Theme (step by step)
  3. How to Edit Css in child Theme
  4. Additional Resources

  1. Why You Need to Create a Child Theme?

There are a few reasons why you would want to use a child theme:

  • If you modify a theme directly and it is updated, then your modifications may be lost. By using a child theme you will ensure that your modifications are preserved.
  • Using a child theme can speed up development time.
  • Using a child theme is a great way to learn about WordPress theme development.
  1. How to Create a Child theme? (step-by-step)

1.1) First you need to open /wp-content/themes/ in your WordPress installation folder and create a new folder for your child theme. You can name this folder anything you want. For this tutorial we will be naming it wpbchild.

1.2) Open a text editor like Notepad and paste this code:

/*
 Theme Name:   WP Child Theme
 Theme URI:    https://hamzashatela.com/
 Description:  Kallyas theme 
 Author:       Hamza shatlea
 Author URI:   https://hamzashatela.com
 Template:     Kallyas theme
 Version:      1.0.0
*/
 
@import url("../Kallyastheme/style.css");

1.3) Save this file as style.css in the child theme folder you just created.
Most of that stuff in this file is self explanatory. What you really want to pay attention to is the Template: “Theme you are using”. (Basic understanding of CSS/HTML is required, so that you can make your own changes. Some knowledge of PHP would certainly help.)
This tells WordPress that our theme is a child theme and that our parent theme directory name is “Theme you are using”. The parent folder name is case-sensitive. If we provide WordPress with Template: “Theme You Are Using“, then it will not work. The last line in this code imports our parent theme’s stylesheet to the child theme.

1.4) Go to Appearance » Themes where you will see WPB Child Theme. You need to click on activate button to start using the child theme on your site.

Since you haven’t changed anything in your child theme yet, your site will use all functionality and appearance of its parent theme.

This is the minimum requirement for creating a child theme. Now you can starting adjusting your child theme.

  1. How to Edit Child theme Css?

First you need to do is select the theme file you want to modify and then copy it into your child theme.

For example, you want to remove ‘powered by WordPress’ link from the footer area and add a copyright notice there. Simply copy the footer.php file in your child theme and then open it in a plain text editor like notepad. Find out the lines you want to remove and replace them with your own. Like this:

<?php
/**
 * The template for displaying the footer
 *
 * Contains footer content and the closing of the #main and #page div elements.
 *
 * @package WordPress
 * @subpackage Twenty_Thirteen
 * @since Twenty Thirteen 1.0
 */
?>
        </div><!-- #main -->
        <footer id="colophon" class="site-footer" role="contentinfo">
            <?php get_sidebar( 'main' ); ?>
            <div class="site-info">
                <p>&copy; Copyright <?php echo date(Y); ?> <?php bloginfo('name'); ?> All rights reserved.</p>
                
            </div><!-- .site-info -->
        </footer><!-- #colophon -->
    </div><!-- #page -->
    <?php wp_footer(); ?>
</body>
</html>

In the above code, we have replaced Theme credits with a copyright notice.Troubleshooting is a lot easier when creating child themes. For example if you accidentally deleted something that your parent theme required, then you can simply delete the file from your child theme and start over.

Additional Child Theme Resources

1. The One Click Child Theme Plugin – If you are having difficulty wrapping your head around the creation of the child theme folder, then this plugin will create one for you with the click of a button!
2. The WordPress Codex – There is all kinds of great documentation in the WordPress codex. If there is anything you need clarification on in this post, then this should be your first stop.

Conclusion

Adding code snippets into a parent theme’s functions.php file means that your changes will be overwritten whenever there is a new update for the parent theme. This is why it is always recommended to use a child theme and add all your custom code snippets into child theme’s functions.php file. You can add any custom code snippet you need in your child theme’s functions.php file. A lot of  wordpress theme providers will include a child theme within the theme package, if you’re theme happened not to include a child theme, learn How To Pick The Perfect WordPress Theme and why does it matter?
Shatela Hamza

About Shatela Hamza

Hamza Shatela is a front-end designer and online business developer with over a decade of digital marketing experience. As the founder of Slide Sigma, Hamza has worked with a series of professionals within the Medical, Financial, Non-Profit, Wedding and Entertainment industries.

What you can read next

Disable WordPress Thumbnails
3 Ways to Disable WordPress from Creating Thumbnails
Build Your Website in Five Steps
Build Your Website in Five Steps
How Much Does a Website Cost?
How Much Does a Website Cost?

constandcontact

WEBSITE HOSTING


Bluehost.com $3.95 Hosting

Recent Posts

  • Install WordPress plugin

    How to install and activate a plugin to WordPress website

  • How to Install WordPress Tutorial

    How to Install WordPress – Complete WordPress Installation Tutorial 101

  • Multisites WordPress

    How to Install a Multisites on WordPress

  • Install WordPress using FTP

    How to Install WordPress using FTP (Manual Installation)

  • Install WordPress MOJO Marketplace

    How to Install WordPress Using MOJO Marketplace

SEO PowerSuit

SEO PowerSuit free Downlaod

RankPay

RankPay SEO Services

constandcontact

Sign up and join 38,371+ of other smart subscribers. Stay up to date with weekly newsletter on market trends and stay on top of your online buiness by having an idepth knowledge of valuable softwares to boost your online business

What do you have to lose? You can unsubscribe anytime.

About

  • About Me

Additional Pages

  • Blog
  • Start a Blog for Free
  • WordPress 1 Year Program

Legal

  • Privacy Policy
  • Term & Conditions
  • Disclosure

Contact

  • Contact

My reviews and opinion on sites are ranked and reviewed on the basis of my own views and expert opinions. I use affiliate links, and I get a commission when you click on any referral website. That’s how I maintain this website. It doesn’t cost you anything. In fact, I guarantee you get the best price when you use my link. Hamzashatela.com cannot and does not present information about every site or site offer available.
© 2018 Hamzashatela. All rights reserved.

TOP