Login with:


Or:


Not a member? Sign Up

Forgot Password?

Signup with:


Or:


Already have an account? Log in

MDW WordPress Tutorial Child Theme

Child Theme


Written by Michał Krawczyk ,

Child themes are very useful when you want to make changes on original themes. They are separate themes with your custom code. It's a good practice to create a child theme because you can be sure that your changes won't be overwritten after you update the original theme. You can also easily turn off your child theme and back to the original theme. How does it work? When your website is using a child theme WordPress will check your custom code first to see if a custom modification exists. If it doesn't, WordPress will use your original parent theme. This is awesome because you can modify only what you need. Creating a child theme is very simple. You just need to follow a few steps:

  1. Connect to your server using FTP protocol with the login information that you have from your hosting provider.
  2. Go to your wp-content/themes directory.
  3. Create a folder with name mdw-child
  4. The Open folder that you just created and create two files: functions.php and style.css.
  5. Now, open your style.css file and paste the following code:
  6. /*
            Theme Name:   MDW Child
            Theme URI:    http://yourwebsite.com/mdw-child/
            Description:  This is my child theme for MDW
            Author:       Your name
            Author URI:   http://yoursite.com
            Template:     mdw
            Version:      1.0
            Tags:         some, tags, goes, here
            Text Domain:  mdw-child
        */
  7. You can modify this code, but be careful. The two important lines in the code above are Theme Name and Template. The Theme Name tells WordPress what is the name of your theme. Template tells WordPress which theme should be used as a parent.
  8. Open functions.php file and paste following code:
  9. <?php
            function custom_theme_enqueue_styles() {
                wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css');
            }
            add_action( 'wp_enqueue_scripts', 'custom_theme_enqueue_styles', 11);
        ?>
                                
  10. Login to your admin dashboard and go to Appearance > Themes to activate your child theme.
  11. To add custom .css classes edit the Child's Theme "style.css" file. You don't have to copy any other file from the MDW package. All the changes will be added from this file. Don't forget to copy "style.css into your FTP server.

Do you want to share?


About author


Michał Krawczyk

Digital Marketing Analyst at MDW with a strong Research and Consulting background, former student of Interfaculty Individual Studies in the humanities at the best university in Poland

Leave a reply

Card image cap

Stay up to date


Subscribe to our newsletter

Rapid change in the world of web development is its inseparable quality. New updates and features are being constantly released, almost every week. Don't forget to be up to date.