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
This commit is contained in:
Ben Word
2011-07-31 00:34:53 -06:00
parent 3e17419dd3
commit 60bbec9176
2 changed files with 8 additions and 9 deletions

View File

@@ -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 // 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()) { 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_action('generate_rewrite_rules', 'roots_add_rewrites');
add_filter('plugins_url', 'roots_clean_plugins'); if (!is_admin()) {
add_filter('bloginfo', 'roots_clean_assets'); add_filter('plugins_url', 'roots_clean_plugins');
add_filter('stylesheet_directory_uri', 'roots_clean_assets'); add_filter('bloginfo', 'roots_clean_assets');
add_filter('template_directory_uri', 'roots_clean_assets'); add_filter('stylesheet_directory_uri', 'roots_clean_assets');
add_filter('template_directory_uri', 'roots_clean_assets');
}
} }
// redirect /?s to /search/ // redirect /?s to /search/

View File

@@ -4,11 +4,8 @@ function roots_admin_enqueue_scripts($hook_suffix) {
if ($hook_suffix !== 'appearance_page_theme_options') if ($hook_suffix !== 'appearance_page_theme_options')
return; return;
$home_url = home_url(); wp_enqueue_style('roots-theme-options', get_template_directory_uri() . '/inc/css/theme-options.css');
$theme_name = next(explode('/themes/', get_template_directory())); wp_enqueue_script('roots-theme-options', get_template_directory_uri() . '/inc/js/theme-options.js');
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");
} }
add_action('admin_enqueue_scripts', 'roots_admin_enqueue_scripts'); add_action('admin_enqueue_scripts', 'roots_admin_enqueue_scripts');