Site logo

Archived topic

Properly enqueueing a stylesheet

3 replies · Started by Daniel on April 1, 2019

Viewing posts 1–4 of 4

Hi Tom and team,

I am using a child theme and scss as part of my development process and I am wanting to enqueue a css stylesheet compiled from my scss files on my child theme. I know that I need to put this in my child theme functions.php file but my knowledge stops there lol.

What is the proper way of enqueueing it? Would you be able to provide me with the php snippet?

Thank you,

D

Hi there,

You can do this:

add_action( 'wp_enqueue_scripts', function() {
    $child_folder = trailingslashit( get_stylesheet_directory_uri() );

    wp_enqueue_style( 'your-style-id', $child_folder . 'your-filename.css' );
} );

Let me know if you need more info :)

Thanks Tom.

Always appreciate the amazing product and even better customer support!

Glad I could help :)

This archived topic is closed to new replies.