• Resolved castalos

    (@castalos)


    My parent theme has 3 stylesheets which are enqueued in the parent functions.php as shown here:

    wp_enqueue_style('ipin-bootstrap', get_template_directory_uri() . '/css/bootstrap.css');
    wp_enqueue_style('ipin-fontawesome', get_template_directory_uri() . '/css/font-awesome.min.css');
    wp_enqueue_style('ipin-style', get_stylesheet_directory_uri() . '/style.css', array('ipin-bootstrap'));

    I’ve set up a child theme with one stylesheet that has modifications to both the ipin-style and the ipin-bootstrap. I’m trying to get this enqueued all properly in my child’s functions.php file.

    This is what I’ve got:

    function enqueue_ipin_main_styles() {
    	wp_enqueue_style( 'ipin-bootstrap', get_template_directory_uri() . '/css/bootstrap.css');
    	wp_enqueue_style( 'ipin-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css');
    	wp_enqueue_style( 'ipin-style', get_template_directory_uri() . '/style.css', array('ipin-bootstrap'));
    }
    add_action( 'wp_enqueue_scripts', 'enqueue_ipin_main_styles' );
    
    function enqueue_ipin_child_style() {
    	wp_enqueue_style( 'ipin-child-style', get_stylesheet_directory_uri() . '/style.css', array('ipin-style'));
    }
    add_action( 'wp_enqueue_scripts', 'enqueue_ipin_child_style' );

    I seem to be getting the parent styles fine. But I’m not getting the child style which modifies the parent style.

    I saw something saying to use the “after_setup_theme” hook with a priority of 11 to load after the parent theme, which will fire on the default priority of 10. Which was why I separated out the two enqueue styles into two functions. But I can’t figure out to use that (and can’t find where I found that reference either).

    Suggestions?
    Thanks,
    Coleen

Viewing 1 replies (of 1 total)
  • Thread Starter castalos

    (@castalos)

    Figured out the problem. I had the child style enqueued properly, but it didn’t seem like it was working. Always a good idea to run the stylesheet through a validator. One missing } can make a big difference on the stylesheet working or not!

Viewing 1 replies (of 1 total)
  • The topic ‘Enqueueing Parent/Child Stylesheets’ is closed to new replies.