Support » Themes and Templates » Changing location of style.css with filters

  • Does anyone have an example of how to change the location of the default style.css file by using the add_filter function?

Viewing 7 replies - 1 through 7 (of 7 total)
  • if you want to change the style.css url add the below code inside your theme’s functions.php

     * wpi_stylesheet_uri
     * overwrite default theme stylesheet uri
     * filter stylesheet_uri
     * @see get_stylesheet_uri()
    function wpi_stylesheet_uri($stylesheet_uri, $stylesheet_dir_uri){
        return $stylesheet_dir_uri.'/css/mytheme.css';

    if you need to change the theme’s stylesheet directory only

     * wpi_stylesheet_dir_uri
     * overwrite theme stylesheet directory uri
     * filter stylesheet_directory_uri
     * @see get_stylesheet_directory_uri()
    function wpi_stylesheet_dir_uri($stylesheet_dir_uri, $theme_name){
    	$subdir = '/css';
    	return $stylesheet_dir_uri.$subdir;

    taken from

    Ah, nice. Thanks chaoskaizer!

    This seems to work initially, but when I add page templates, they are not found. Then, when I visit the ‘Theme’ page it says the theme style sheet is missing and reverts to the the default theme. This seems odd, as the link is correct and the design of the site is fine prior to visiting the theme section.

    Has this happened to anyone else?

    Has anyone else had this problem? changing the location of the style sheets makes the theme inactive if you are in theme section of the wp-admin?

    Anyone else had an issue with this?

    I googled here and tried the code above, It works well.

    To solve the “the theme style sheet is missing” problem, just write some theme info only in a file, named style.css and put in your theme directory.

    Forgive me for bad English.

    HI xwingyz,

    Yes I did that, and it worked 😉 I was just curious if there was a way to get around have to create the extra style.css file in the theme’s root directory.

    I don’t think there is…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Changing location of style.css with filters’ is closed to new replies.