1
votes

I just created a child theme and activated it.But when I visit the page,it's completely blank.

In the display is the themes folder where I have my parent theme and the child,then below is the site details from the parent style.css which I simply copied and pasted to the child stylesheet.

enter image description here

functions.php looks like this:

<?php
function my_theme_enqueue_styles() {

    $parent_style = 'parent-style';

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get('Version')
    );
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>

As the photo shows,the theme is active.

enter image description here

How can I create a child theme and make it visible as the parent theme?

2
Completely blank page is maybe a result of an error. Is WP_DEBUG true?Andy Tschiersch
@Andy Tschiersch.Yes it is set to true. I created the child theme previously using the twenty sixteen theme,wp-debug was set to false and it worked.user agent

2 Answers

3
votes

You shouldn't just copy the parent style, it's better to create a new one and import the parent's. You also need to specify the Template as the parent theme. Try using this:

/*
    Theme Name:   Sidimaag Child Theme
    Theme URI:    http://underscores.me
    Description:  Sidimaag Child Theme
    Author:       mytheme
    Author URI:   http://mytheme.co.za
    Template:     sidimaag
    Version:      1.0.0
    License:      GNU General Public License v2 or later
    License URI:  http://www.gnu.org/licenses/gpl-2.0.html
    Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
    Text Domain:  sidimaag
    */

Then you can use @import to import the parent's style like this:

@import url('path_to_parent_theme/style.css');
0
votes

To save your life,just install themify plugin. It is very straightforward. You install the plugin. Go to: Appearance -> Themes When you see your themes,hover over it and you'll see Theme Details. Click on it and then look for the button named: create child theme..name your theme,click ok...and vuala!!!