WordPress.org

Forums

[resolved] style.css file in a folder (12 posts)

  1. Gaurav
    Member
    Posted 4 years ago #

    Hi Guys,

    Can someone guide if i move the style.css in a folder from the root i am unable to activate the theme from the admin.

    So what code should i add to header.php so it picks up the style.css and activate the theme properly.

    As per Theme Development Standards wordpress requires that the style.css file should be on the root we had to move the file on the root.

    As you know in wordpress the style.css file in on the root.

    Gaurav

  2. Chip Bennett
    Theme Review Admin
    Posted 4 years ago #

    The Theme's style.css file must be in the Theme root directory. So, for "My Test Theme", the root folder is:

    \wp-content\themes\my-test-theme\

    And the style.css file must be here:

    \wp-content\themes\my-test-theme\style.css
  3. Gaurav
    Member
    Posted 4 years ago #

    So Chip, there is no way i can have the style.css in a folder?

  4. Chip Bennett
    Theme Review Admin
    Posted 4 years ago #

    Not as far as I know.

    What are you trying to accomplish, that you need/want to move the style.css file into a sub-folder from the Theme root?

  5. Gaurav
    Member
    Posted 4 years ago #

    Yes, in one of my project the client is asking for this.

    That the style.css should be in a folder and not on root.

  6. Chip Bennett
    Theme Review Admin
    Posted 4 years ago #

    To what "root" are you referring: the Theme root, or the site/WordPress root?

  7. Gaurav
    Member
    Posted 4 years ago #

    When we try to move the css file the theme does not activate.

    From what i know the style.css should on the root of the theme folder, otherwise the theme will not activate.

  8. Gaurav
    Member
    Posted 4 years ago #

    By root i mean the theme folder root.

    for e.g my theme folder name is "abc"

    and i wan that the style.css should be in a folder named "css"

    So the css folder will be in me "abc" folder.

  9. Gaurav
    Member
    Posted 4 years ago #

    So the folder will be:-

    \wp-content\themes\abc

  10. Chip Bennett
    Theme Review Admin
    Posted 4 years ago #

    Why is your client asking for this?

    Again: as far as I know, the style.css file must be in the Theme root.

    You can put other CSS files into a sub-folder, but not style.css.

  11. Gaurav
    Member
    Posted 4 years ago #

    ok, will do that and import all the other css files in to style.css.

    Thanks for the help

  12. alchymyth
    Forum Moderator
    Posted 4 years ago #

    i agree, you must have the style.css file with the neccessary theme information in the theme root folder;
    however, imho, and as @Chip Bennett already said, you can have as many other folders with css files as you like, and there is no reason why these css files cannot be named style.css as well;

    example:
    /wp-content/themes/abc/style.css (this is the neccessary style.css to get the theme recognized)

    /wp-content/themes/abc/css_folder/style.css
    /wp-content/themes/abc/css_folder/custom.css

    as long as you link these css files properly from the header;
    and you don't even have to link the style.css in the theme root.

    there are actually many themes that do this.

Topic Closed

This topic has been closed to new replies.

About this Topic