• Resolved johnbrid

    (@johnbrid)


    I am using a child theme with customizr. I am using the enqueue method in function.php. There does not seem to be anything wrong with my child themes style.css file. It cheks out with no errors in a Lint validator. If i switch back to the customizr theme and put the childs themes style.css contents in the advanced css box everything works fine. When i go back to my child theme, all the style changes are fine but the widgets are in the wrong place. The left side bar widget goes to the top and the right side widget goes to the bottom. I have even tried two different function.php files that i found and bot behvae the same.

    <?php
    function themeslug_enqueue_style() {
    if ( is_child_theme() ) {
    // load parent stylesheet first if this is a child theme
    wp_enqueue_style( ‘parent-stylesheet’, trailingslashit( get_template_directory_uri() ) . ‘style.css’, false );
    }
    // load active theme stylesheet in both cases
    wp_enqueue_style( ‘theme-stylesheet’, get_stylesheet_uri(), false );
    }

    add_action( ‘wp_enqueue_scripts’, ‘themeslug_enqueue_style’ );
    ?>

    and another one

    <?php
    remove_action(‘wp_print_styles’, ‘cc_tabby_css’, 30);

    function theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );

    }
    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );

    ?>

    I am amazed at how different they both are but they both execute the style changes properly but both move the widgets. Can anybody help.
    Thanks

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi John,
    in CSS the rules loading order makes a lot of difference.
    When there are two (or more) rules with same specificity, the latter will override the previous one.

    Anyway the Customizr theme doesn’t need any additional code in the child-theme functions.php, to load the child-theme stylesheet:
    The Customizr theme takes care about loading it ensuring the correct order (after the parent theme stylesheet).

    About your issue with the sidebar:
    I can see from your page that the div with id="content" misses the class attribute value – which is needed to give a certain width to it.
    https://github.com/presscustomizr/customizr/blob/v4.0.16/index.php#L24

    So there’s something in your child-theme php part (did you override any php file?) that causes that.

    Thread Starter johnbrid

    (@johnbrid)

    Thank you so much Rocco. With your help in tracking it down it is now solved. I checked all my .php files in the child theme and it was my childs index.php causing the problem and I do not even know why it was there as I am sure it is not needed. I had copied the customizer theme index.php across to the child theme. Maybe by accident with a double click on a directory in Filezilla. With it deleted it all works fine. I think unless you have made changes you do not actually need the.php files at all for a child theme apart from function.php to do the enqueing. Is that right?

    Hi john,
    glad you solved.

    Yes that’s right, even the child-theme functions.php is not strictly needed to make a child-theme, but unless your aim is to change only the CSS, you might need it in the future.

    Best regards.

    Rocco

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Child theme function.php widget problem’ is closed to new replies.