3

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

0

2 Answers 2

4

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.

9
  • @the_dramatist.No. Basically,the child theme is active,all I want is to be able to view the site when I click on visit site. Oct 25, 2016 at 7:45
  • How can I create a child theme and make it visible as the parent theme? I though you need this question answer.
    – CodeMascot
    Oct 25, 2016 at 7:48
  • the child theme is created and activated as you can see from the photo. The problem is that when I visit the site, I don't see any content.And when I inspect the element,there is nothing as well Oct 25, 2016 at 7:52
  • check the updated answer.
    – CodeMascot
    Oct 25, 2016 at 7:53
  • index.php deleted.But page is still blank Oct 25, 2016 at 9:15
1

*
 Theme Name:   Twenty Fifteen Child
 Theme URI:    http://example.com/twenty-fifteen-child/
 Description:  Twenty Fifteen Child Theme
 Author:       John Doe
 Author URI:   http://example.com
 Template:     twentyfifteen
 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:  twenty-fifteen-child
*/

See carefully wordpress coding standard. You have forgot define Template of your parents theme. Please define Template of your parent theme and then see. Hope this will help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.