How to enqueue style.css file in WordPress theme

wordpress-functions

It is best to combine all enqueued scripts and styles into a single function, and then call them using the wp_enqueue_scripts action.

function add_theme_scripts() {
	wp_enqueue_style( 'style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'add_theme_scripts' );

add_theme_scripts() → Any name can be used for naming the function

get_stylesheet_uri() → This function automatically finds the style.css file in the theme folder and outs its URL.

Leave a comment

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