if you want to change the style.css
url add the below code inside your theme’s functions.php
add_filter('stylesheet_uri','wpi_stylesheet_uri',10,2);
/**
* 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
add_filter('stylesheet_directory_uri','wpi_stylesheet_dir_uri',10,2);
/**
* 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 http://code.google.com/p/wp-istalker/source/browse/branches/WordPress/2.7/1.6.2/lib/modules/filters.php#326
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…