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?

This is what I see when I load the page and try to inspect:

enter image description here

2 Answers
2

I think you’ve nothing in the index.php file. So what is happening that the child theme is calling the child theme’s index.php over parent theme’s index.php. And you have nothing on index.php. So the site is showing nothing. Delete the child theme’s index.php. You’ll see the site live.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *