Paste the code below into your functions.php file.
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() {
wp_enqueue_style( 'my-custom-css', 'PATH TO CSS FILE', false );
}
add_action( 'wp_enqueue_scripts', 'enqueue_my_custom_styles' );
1 thought on “Use WP Enqueue Style To Properly Add CSS Files To WordPress”
Hey Bjorn, BIG thanks of an excellent tutorial.
Can you please clarify:
In the code you supply, I noticed that the wp_enqueue_style line and the add_action line, both contain the words “my-custom-css”
In the YouTube tutorial you changed ‘my-custom-css’ to “animate.min.css”
But you did not change the add_action line.
Can you please confirm that we do not need to edit the add_action line so that it matches whatever name we enter in the wp_enqueue_style line?
Thanks,
Julian