Forum Replies Created

Viewing 16 replies (of 16 total)
  • Hey,

    Yes, in WordPress, it’s a good practice to use wp_enqueue_style for each stylesheet that you want to load on your website. This function allows you to manage dependencies, specify the version, and control the load order of your stylesheets.

    If you have multiple stylesheets that need to be loaded, you can use wp_enqueue_style multiple times in your functions.php file or a separate file that handles enqueuing assets.

    For example:

    function my_theme_styles() {
    // Enqueue the main stylesheet
    wp_enqueue_style( 'my-theme-main-style', get_stylesheet_uri(), array(), '1.0.0' );

    // Enqueue an additional stylesheet
    wp_enqueue_style( 'my-theme-custom-style', get_template_directory_uri() . '/css/custom-style.css', array(), '1.0.0' );

    // Enqueue another additional stylesheet
    wp_enqueue_style( 'my-theme-another-custom-style', get_template_directory_uri() . '/css/another-custom-style.css', array(), '1.0.0' ); }

    add_action( 'wp_enqueue_scripts', 'my_theme_styles' );

Viewing 16 replies (of 16 total)