• Resolved Krushna Ghodke

    (@krushnaghodke)


    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?

Viewing 5 replies - 1 through 5 (of 5 total)
  • you need have a main CSS file in the main wordpress theme directory and it named as

    style.css

    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

    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.

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

    Thread Starter Krushna Ghodke

    (@krushnaghodke)

    Thank You All 🙂

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How To Add Multiple CSS files in your wordpress theme?’ is closed to new replies.