Support » Themes and Templates » Enqueuing multiple style sheets

  • I’m working on a theme with several style sheets, but I am not able to effect any changes I make to the style sheets I have created in my child theme. The file paths of the two I am updating is as follows:

    /style.css
    /assets/css/theme-styles.css

    My functions.php file looks like this:

    add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
    
    function enqueue_parent_styles() {
       wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
       wp_enqueue_style( 'parent-theme-styles.css', get_template_directory_uri().'/assets/css/theme-styles.css' );
    }

    The style.css contains only the following (as per the original)

    @import url(assets/css/normalize.css);
    @import url(assets/css/icomoon.css);
    @import url(assets/css/theme-styles.css);
    @import url(assets/css/woocomerce.css);
    

    Incidentally, any amendments I make to the original theme-styles.css sheet are reflected straight away on my site (on localhost) so I don’t believe it is a cache issue.

    Does any body have any ideas what I may be doing incorrectly?

    Thanks in advance!
    Paul

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php
    function my_theme_enqueue_styles() {
    
        $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen 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' );
    ?>

    https://codex.wordpress.org/Child_Themes

    [moderator note – signature removed as per forum rules]

    Thanks webkong. Not entirely sure what you are suggesting I should do – I am not working with twentyfifteen for starters. Are you able to clarify for me?
    Thanks a lot
    Paul

    Were you able to solve this issue? I am running into the same problem.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Enqueuing multiple style sheets’ is closed to new replies.