Support » Themes and Templates » Child theme not incorporating Child Style.css

  • I’ve done MANY child themes in the past, but this one is currently stumping me.

    I took a look at the header of the style.css of the parent and this is what I got:

    Theme Name: Parent Theme
    Theme URI:
    Description: This is the parent theme
    Author: Theme Author
    Author URI:
    License: GNU General Public License v2 or later
    License URI:
    Version: 1.0
    @package Top10
    @since Top10 1.0

    And here is MY child style.css

     Theme Name:   Top 10 Child
     Template:     top10

    WordPress Codex says those are the only two lines “really” needed to link the parent and the child. I’ve never seen the @package or the @since tags in the header before, and I feel they may have something to do with my dilemma

Viewing 6 replies - 1 through 6 (of 6 total)
  • I think you may need to add a function to include the stylesheet in the child’s own functions.php. It shouldn’t break anything just have your stylesheet take precedence over the parent stylesheet.

    fantastic… news code to learn. Is there a direction you can point me to this magic function?

    I’ve firgured out how to FINALLY incorporate the child theme’s style.css, but the original css is still overwriting the child.

    I looked up my issue and I was informed that wp_deregister_style would unload the original, but it is not. Here’s what my functions.php look like now:

    wp_deregister_style( ‘theme-style’ );
    $scripts_uri = get_stylesheet_uri();
    wp_register_style( 'whp-style', $scripts_uri, array(), '', 'all');
    wp_enqueue_style( 'whp-style' );

    You need to add the parent theme declaration in your child theme.
    @import url("../PARENTTHEME/style.css");

    More info here.

    @batharoy I already have that, but the parent.css is empty. The theme styles are being loaded through a wp_enqueue_style in the parent theme’s theme-functions.php

    HUZZAH! The following code works:

    function remove_css(){
    	wp_dequeue_style( 'theme-style' );
    	wp_deregister_style( 'theme-style' );
    add_action('wp_print_styles', 'remove_css', 99999);
    $scripts_uri = get_stylesheet_uri();
    wp_register_style( 'whp-style', $scripts_uri, array(), '', 'all');
    wp_enqueue_style( 'whp-style' );

    I just had to make sure the add_action was set to higher priority. THANK YOU BRAIN! THANK YOU!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Child theme not incorporating Child Style.css’ is closed to new replies.