• Hi,

    Just getting started (well, I started a couple years ago, got derailed by other projects, and am restarting now).

    I want to make a child theme of twentysixteen. I followed the examples/instructions exactly I thought (https://codex.wordpress.org/Child_Themes), but it’s still telling me the stylesheet is missing. Here’s my style.css:

    /*
    Theme Name: Twenty Sixteen K2
    Theme URI: http://x.x.x.x/twentysixteen-k2/
    Description: Twenty Sixteen Child Theme for K2
    Author: John Doe
    Author URI: http://example.com
    Template: twentysixteen
    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-sixteen-k2
    */

    Here’s functions.php:

    <?php
    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
    function theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );

    }

    function 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 )
    );
    }
    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );

    ?>

    (yes, I have real #s in the theme uri, just felt weird posting them)

    Obviously I haven’t made any changes or added any of my own styles yet. Just trying to get it up and running first.

    One thing that isn’t clear is if “parent-syle” is static text I should be putting there or if they want me to put the name of the theme/style of twentysixteen. I tried both “parent-style” and “twenty-sixteen” and neither one worked.

    Can someone help set me right?

    Thanks,

    Jeff

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jscooper

    (@jscooper)

    As an experiment, I tried making a child of twentyfifteen and copied and pasted the examples exactly as-is, including the name of the directory, and it’s still not working. Seems to be something in the documentation that’s either an error or I’m misreading.

    Thanks,

    Jeff

    In reviewing the source of your functions.php, it seems you have declared the function theme_enqueue_styles twice. Only the first instance of the function is processed while the second will throw a notice/error depending on your PHP configuration. Remove the first add_action and declaration of the function and you should be good to go.

    When you’re done, your functions file should only contain the following for loading styles:

    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'theme-style', get_stylesheet_directory_uri() . '/style.css', array( 'parent-style' ) );
    }
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );

    Hope this helps.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Twentysixteen Child Theme Stylesheet Missing’ is closed to new replies.