[resolved] How To Add Multiple CSS files in your wordpress theme? (6 posts)

  1. Krushna Ghodke
    Posted 3 years ago #

    Actually i am converting my static HTML/CSS theme into WordPress theme for my project so, theme are multiple CSS files in the css folder so how to add multiple CSS to wordpress theme?

  2. aritzalvarez
    Posted 3 years ago #

    you need have a main CSS file in the main wordpress theme directory and it named as


    and call it as

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />

    it's a condition needed to wordpress allows you to use as theme.

    but, once done it you can call som many CSS files as you need by...

    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/address-to-css-file.css" type="text/css" media="screen" />

    Please, notice than function

    <?php bloginfo('template_directory'); ?>

    prits you wordpress template directory withou the ending slash, so you need add it

  3. David Laietta
    Posted 3 years ago #

    Additionally, you can import new CSS files in your main stylesheet through imports.

    After you have your main style.css file loading, you can tell that stylesheet to load additional CSS files, based on a relative location. Since that file has to be in the main folder of your theme, let's say you have others in a css folder in the theme. Your imports would then look like this:

    /* Stylesheet comments here */
    @import url('css/slider.css');
    @import url('css/colors.css');

    Based on the names of your files and the folders that they are in. This gives you the added bonus of being able to control load order for cascading styles.

  4. Michael
    Forum Moderator
    Posted 3 years ago #

    also review http://codex.wordpress.org/Function_Reference/wp_enqueue_style for how to enqueue stylesheets.

  5. Krushna Ghodke
    Posted 3 years ago #

    Thank You All :)

  6. gunalan87
    Posted 2 years ago #

    Reference will be useful anyone who doesn't know how to add CSS and JS files through functions.php

Topic Closed

This topic has been closed to new replies.

About this Topic