From 60bbec9176749387584b661b247cdc011fabacde Mon Sep 17 00:00:00 2001 From: Ben Word Date: Sun, 31 Jul 2011 00:34:53 -0600 Subject: [PATCH] made sure that the clean assets functions aren't being applied if you're in the admin, cleaner way of including the theme options js/css now that the clean assets function isn't interfering with get_template_directory_uri --- inc/roots-cleanup.php | 10 ++++++---- inc/roots-options.php | 7 ++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/inc/roots-cleanup.php b/inc/roots-cleanup.php index b63997f..03b6dfd 100644 --- a/inc/roots-cleanup.php +++ b/inc/roots-cleanup.php @@ -45,10 +45,12 @@ function roots_clean_plugins($content) { // only use clean urls if the theme isn't a child or an MU (Network) install if ((!defined('WP_ALLOW_MULTISITE') || (defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE !== true)) && !is_child_theme()) { add_action('generate_rewrite_rules', 'roots_add_rewrites'); - add_filter('plugins_url', 'roots_clean_plugins'); - add_filter('bloginfo', 'roots_clean_assets'); - add_filter('stylesheet_directory_uri', 'roots_clean_assets'); - add_filter('template_directory_uri', 'roots_clean_assets'); + if (!is_admin()) { + add_filter('plugins_url', 'roots_clean_plugins'); + add_filter('bloginfo', 'roots_clean_assets'); + add_filter('stylesheet_directory_uri', 'roots_clean_assets'); + add_filter('template_directory_uri', 'roots_clean_assets'); + } } // redirect /?s to /search/ diff --git a/inc/roots-options.php b/inc/roots-options.php index 802d500..230e715 100644 --- a/inc/roots-options.php +++ b/inc/roots-options.php @@ -4,11 +4,8 @@ function roots_admin_enqueue_scripts($hook_suffix) { if ($hook_suffix !== 'appearance_page_theme_options') return; - $home_url = home_url(); - $theme_name = next(explode('/themes/', get_template_directory())); - - wp_enqueue_style('roots-theme-options', "$home_url/wp-content/themes/$theme_name/inc/css/theme-options.css"); - wp_enqueue_script('roots-theme-options', "$home_url/wp-content/themes/$theme_name/inc/js/theme-options.js"); + wp_enqueue_style('roots-theme-options', get_template_directory_uri() . '/inc/css/theme-options.css'); + wp_enqueue_script('roots-theme-options', get_template_directory_uri() . '/inc/js/theme-options.js'); } add_action('admin_enqueue_scripts', 'roots_admin_enqueue_scripts');