• Hey guys,

    I’m trying to install a child theme but it’s not taken into account. I think all the steps from the child theme codex. Can you tell me where is my mistake? Here is what I have:
    tree of my project

    functions.php

    <?php
    function my_theme_enqueue_styles() {
    
        $parent_style = 'parent-style'; // This is 'shoreditch' for the Shoreditch theme.
    
        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' );
    ?>

    style.css:

    /*
     Theme Name:   Shoreditch Child
     Theme URI:    https://openclassrooms-project-2-cellendhyll82.c9users.io/shoreditch-child/
     Description:  Shoreditch Child Theme
     Author:       Cellendhyll
     Author URI:   https://openclassrooms-project-2-cellendhyll82.c9users.io
     Template:     shoreditch
     Version:      1.0.0
     License:      GNU General Public License v2 or later
     License URI:  https://www.gnu.org/licenses/gpl-2.0.html
     Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
     Text Domain:  shoreditch-child
    */
    
    /* =Theme customization starts here
    -------------------------------------------------------------- */
    

    Thx ??

    • This topic was modified 7 years, 8 months ago by cellendhyll.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    It won’t help much, but this line:
    $parent_style = 'parent-style';
    isn’t quite correct. ‘parent-style’ should be the actual style tag used by the parent theme, in this case ‘shoreditch-style’. Usually the only problem from not using the correct tag is a CSS file gets loaded twice. However, if it causes the files to be loaded in the wrong order, there will be problems with the child CSS properly overriding the parent’s. This is not the case here, just sayin’.

    To make sure I haven’t missed something, I installed the shoreditch theme on my test installation and replicated your child theme as you presented it, only adding CSS to change the background color. This change was applied correctly, so your child theme has been properly implemented as far as my test site is concerned.

    From what you’ve presented, there would be no difference in site appearance or function. I’m assuming there is more to your child theme than what you’ve presented. What is it that you are trying to do that’s not working?

Viewing 1 replies (of 1 total)
  • The topic ‘Child theme not working’ is closed to new replies.