Support » Theme: Coraline » Error when previewing child theme

  • I got this error when previewing a child theme I created. The error message is:
    Fatal error: Call to undefined function get_current_screen() in ~/wp-admin/includes/dashboard.php on line 23

    I created the child directory in ~/wp-content/themes/coraline-child with the following files:
    1. functions.php
    <?php
    add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
    function my_theme_enqueue_styles()
    {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
    }

    2. style.css
    /*
    Theme Name: Coraline Child
    Description: Coraline Child Theme
    Template: coraline
    Version: 1.0.0
    Text Domain: coraline-child
    */
    ?>

    Any idea what could have gone wrong?

    Thanks,
    Bee

Viewing 1 replies (of 1 total)
  • sacredpath

    (@sacredpath)

    Automattic Happiness Engineer

    Hi there, is this ?> in your CSS file, or is it supposed to be at the end of the functions.php code above?

    Where is says parent-style in the wp_enqueue for the style.css, you have to replace that with the $handle used in the parent theme functions.php file, which in this case is coraline, so your functions.php would look like this.

    <?php
    add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
    function my_theme_enqueue_styles()
    {
    wp_enqueue_style( ‘coraline’, get_template_directory_uri() . ‘/style.css’ );
    }
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Error when previewing child theme’ is closed to new replies.