Search
Close this search box.

Add CSS To Specific WordPress Pages

[updated_on]
Share this post:

Paste the code below into your functions.php file. Then replace ID with the page ID of the page you want to include the files on. Check out the video tutorial if you need help finding the page ID.

Then, replace PATH TO CSS FILE with the absolute or relative URL to the CSS file you want to include.

function enqueue_my_custom_styles() {
    if( is_page( ID ) ) {
        wp_enqueue_style( 'my-custom-css', 'PATH TO CSS FILE', false ); 
    }    
}

add_action( 'wp_enqueue_scripts', 'enqueue_my_custom_styles' );
Share this post:

Leave a Comment

Your email address will not be published. Required fields are marked *

WPLearningLab