Home only first line of wp_enqueue_style gets executed
Reply: 0

only first line of wp_enqueue_style gets executed

user1798
1#
user1798 Published in July 23, 2018, 1:20 pm

I'm trying to build a child theme for an existing theme someone else built. That theme uses multiple stylesheets and of course, I want the child theme to enqueue them all.

Strangely enough I noticed that that only the first line of the wp_enqueue_style() of the parent theme gets executed while the wp_enqueue_style() of the child theme does work.

I'm kinda stuck and I have no clue on how to make the child theme use all those stylesheets.

    function my_theme_enqueue_styles() {

    //parent style
    $parent_style = 'parent-style';

    //enqueue css of the parent theme
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/assets/scripts/css/bootstrap.min.css' );
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/assets/scripts/css/custom-login.css' );
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/assets/scripts/css/font-awesome.min.css' );
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/assets/scripts/css/font-dc-cash.css' );
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/assets/scripts/css/font-dccash.css' );
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/assets/scripts/css/hro-admin.css' );

    //enqueue css of the child theme
    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' );

btw: I know that those css files dont't make any sense. Tell that to the original builder.

download link of the parent theme

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.384366 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO