diff --git a/functions.php b/functions.php index 2a37bb8..c1b910a 100644 --- a/functions.php +++ b/functions.php @@ -1,5 +1,8 @@ \ No newline at end of file +?> diff --git a/includes/roots-admin.php b/includes/roots-admin.php index e9e7851..dbaad90 100644 --- a/includes/roots-admin.php +++ b/includes/roots-admin.php @@ -8,10 +8,12 @@ function roots_admin_init() { //wp_register_script('roots_codemirror', "$site_url/wp-content/themes/roots/includes/js/codemirror/codemirror.js"); //wp_enqueue_script('roots_codemirror'); + + $theme_name = next(explode('/themes/', get_template_directory())); wp_enqueue_script('jquery-ui-tabs'); - wp_register_style('roots_admin', "$site_url/wp-content/themes/roots/includes/css/admin.css"); - wp_register_script('roots_admin', "$site_url/wp-content/themes/roots/includes/js/scripts.js"); + wp_register_style('roots_admin', "$site_url/wp-content/themes/$theme_name/includes/css/admin.css"); + wp_register_script('roots_admin', "$site_url/wp-content/themes/$theme_name/includes/js/scripts.js"); wp_enqueue_style('roots_admin'); wp_enqueue_script('roots_admin'); } diff --git a/includes/roots-cleanup.php b/includes/roots-cleanup.php index 9357060..4fdc7fe 100644 --- a/includes/roots-cleanup.php +++ b/includes/roots-cleanup.php @@ -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; diff --git a/includes/roots-options.php b/includes/roots-options.php index c031ec1..4d6d57f 100644 --- a/includes/roots-options.php +++ b/includes/roots-options.php @@ -6,8 +6,11 @@ add_action('admin_menu', 'roots_create_menu'); function roots_create_menu() { $icon = get_template_directory_uri() . '/includes/images/icon-roots.png'; - // create menu - add_object_page('Roots Settings', 'Roots', 'administrator', 'roots', 'roots_settings_page', $icon); + // create menu + + $theme_name = get_current_theme(); + + add_object_page($theme_name . ' Settings', $theme_name, 'administrator', 'roots', 'roots_settings_page', $icon); // call register settings function add_action('admin_init', 'roots_register_settings'); @@ -40,7 +43,7 @@ function roots_settings_page() { ?>
-

Roots Settings

+

Settings

Settings saved.