Updates to make roots dir/theme renameable
This commit is contained in:
@@ -10,12 +10,13 @@ function roots_flush_rewrites() {
|
||||
$wp_rewrite->flush_rules();
|
||||
}
|
||||
|
||||
function roots_add_rewrites() {
|
||||
function roots_add_rewrites($content) {
|
||||
$theme_name = next(explode('/themes/', get_template_directory()));
|
||||
global $wp_rewrite;
|
||||
$roots_new_non_wp_rules = array(
|
||||
'css/(.*)' => 'wp-content/themes/roots/css/$1',
|
||||
'js/(.*)' => 'wp-content/themes/roots/js/$1',
|
||||
'img/(.*)' => 'wp-content/themes/roots/img/$1',
|
||||
'css/(.*)' => 'wp-content/themes/'. $theme_name . '/css/$1',
|
||||
'js/(.*)' => 'wp-content/themes/'. $theme_name . '/js/$1',
|
||||
'img/(.*)' => 'wp-content/themes/'. $theme_name . '/img/$1',
|
||||
'plugins/(.*)' => 'wp-content/plugins/$1'
|
||||
);
|
||||
$wp_rewrite->non_wp_rules += $roots_new_non_wp_rules;
|
||||
@@ -25,7 +26,9 @@ add_action('generate_rewrite_rules', 'roots_add_rewrites');
|
||||
add_action('admin_init', 'roots_flush_rewrites');
|
||||
|
||||
function roots_clean_assets($content) {
|
||||
$current_path = '/wp-content/themes/roots';
|
||||
$theme_name = next(explode('/themes/', $content));
|
||||
$current_path = '/wp-content/themes/' . $theme_name;
|
||||
//$current_path = '/wp-content/themes/roots';
|
||||
$new_path = '';
|
||||
$content = str_replace($current_path, $new_path, $content);
|
||||
return $content;
|
||||
|
||||
Reference in New Issue
Block a user