From e509af852c108ddb5bc077bed46104ea2d90520b Mon Sep 17 00:00:00 2001 From: rboren Date: Sat, 12 Feb 2005 19:06:06 +0000 Subject: [PATCH] Add theme directory location hooks. git-svn-id: http://svn.automattic.com/wordpress/trunk@2292 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 40 +++++++++++++++++++--- wp-includes/template-functions-general.php | 9 ++--- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 6dbf142d6..6aeff58d6 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1267,20 +1267,50 @@ function the_post() { $wp_query->the_post(); } +function get_theme_root() { + return apply_filters('theme_root', ABSPATH . "wp-content/themes"); +} + +function get_theme_root_uri() { + return apply_filters('theme_root_uri', get_settings('siteurl') . "/wp-content/themes", get_settings('siteurl')); +} + function get_stylesheet() { return apply_filters('stylesheet', get_settings('stylesheet')); } +function get_stylesheet_directory() { + $stylesheet = get_stylesheet(); + $stylesheet_dir = get_theme_root() . "/$stylesheet"; + return apply_filters('stylesheet_directory', $stylesheet_dir, $stylesheet); +} + +function get_stylesheet_directory_uri() { + $stylesheet = get_stylesheet(); + $stylesheet_dir_uri = get_theme_root_uri() . "/$stylesheet"; + return apply_filters('stylesheet_directory_uri', $stylesheet_dir_uri, $stylesheet); +} + +function get_stylesheet_uri() { + $stylesheet_dir_uri = get_stylesheet_directory_uri(); + $stylesheet_uri = $stylesheet_dir_uri . "/style.css"; + return apply_filters('stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri); +} + function get_template() { return apply_filters('template', get_settings('template')); } function get_template_directory() { $template = get_template(); + $template_dir = get_theme_root() . "/$template"; + return apply_filters('template_directory', $template_dir, $template); +} - $template = ABSPATH . "wp-content/themes/$template"; - - return $template; +function get_template_directory_uri() { + $template = get_template(); + $template_dir_uri = get_theme_root_uri() . "/$template"; + return apply_filters('template_directory_uri', $template_dir_uri, $template); } function get_theme_data($theme_file) { @@ -1324,8 +1354,8 @@ function get_themes() { $themes = array(); $wp_broken_themes = array(); - $theme_loc = 'wp-content/themes'; - $theme_root = ABSPATH . $theme_loc; + $theme_root = get_theme_root(); + $theme_loc = str_replace(ABSPATH, '', $theme_root); // Files in wp-content/themes directory $themes_dir = @ dir($theme_root); diff --git a/wp-includes/template-functions-general.php b/wp-includes/template-functions-general.php index 69145ba61..9e6da9aac 100644 --- a/wp-includes/template-functions-general.php +++ b/wp-includes/template-functions-general.php @@ -96,17 +96,14 @@ function get_bloginfo($show='') { $output = get_settings('siteurl') .'/xmlrpc.php'; break; case 'stylesheet_url': - $output = get_stylesheet(); - $output = get_settings('siteurl') . "/wp-content/themes/$output/style.css"; + $output = get_stylesheet_uri(); break; case 'stylesheet_directory': - $output = get_stylesheet(); - $output = get_settings('siteurl') . "/wp-content/themes/$output"; + $output = get_stylesheet_directory_uri(); break; case 'template_directory': case 'template_url': - $output = get_template(); - $output = get_settings('siteurl') . "/wp-content/themes/$output"; + $output = get_template_directory_uri(); break; case 'admin_email': $output = get_settings('admin_email');