Restore the functionality of the theme_root filter. See #10467.
git-svn-id: https://develop.svn.wordpress.org/trunk@12043 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a4789b3cc1
commit
097a918639
|
@ -261,8 +261,8 @@ function get_themes() {
|
||||||
if ( isset($wp_themes) )
|
if ( isset($wp_themes) )
|
||||||
return $wp_themes;
|
return $wp_themes;
|
||||||
|
|
||||||
/* Register wp-content/themes as a theme directory */
|
/* Register the default root as a theme directory */
|
||||||
register_theme_directory( 'themes' );
|
register_theme_directory( get_theme_root() );
|
||||||
|
|
||||||
if ( !$theme_files = search_theme_directories() )
|
if ( !$theme_files = search_theme_directories() )
|
||||||
return false;
|
return false;
|
||||||
|
@ -493,17 +493,22 @@ function get_current_theme() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a directory that contains themes relative to the content directory.
|
* Register a directory that contains themes.
|
||||||
*
|
*
|
||||||
* @since 2.9.0
|
* @since 2.9.0
|
||||||
*
|
*
|
||||||
|
* @param string $directory Either the full filesystem path to a theme folder or a folder within WP_CONTENT_DIR
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function register_theme_directory( $directory) {
|
function register_theme_directory( $directory) {
|
||||||
global $wp_theme_directories;
|
global $wp_theme_directories;
|
||||||
|
|
||||||
/* The theme directory should be relative to the content directory */
|
/* If this folder does not exist, return and do not register */
|
||||||
|
if ( !file_exists( $directory ) )
|
||||||
|
/* Try prepending as the theme directory could be relative to the content directory */
|
||||||
$registered_directory = WP_CONTENT_DIR . '/' . $directory;
|
$registered_directory = WP_CONTENT_DIR . '/' . $directory;
|
||||||
|
else
|
||||||
|
$registered_directory = $directory;
|
||||||
|
|
||||||
/* If this folder does not exist, return and do not register */
|
/* If this folder does not exist, return and do not register */
|
||||||
if ( !file_exists( $registered_directory ) )
|
if ( !file_exists( $registered_directory ) )
|
||||||
|
@ -523,7 +528,6 @@ function register_theme_directory( $directory ) {
|
||||||
*/
|
*/
|
||||||
function search_theme_directories() {
|
function search_theme_directories() {
|
||||||
global $wp_theme_directories, $wp_broken_themes;
|
global $wp_theme_directories, $wp_broken_themes;
|
||||||
|
|
||||||
if ( empty( $wp_theme_directories ) )
|
if ( empty( $wp_theme_directories ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -609,12 +613,16 @@ function search_theme_directories() {
|
||||||
* @return string Theme path.
|
* @return string Theme path.
|
||||||
*/
|
*/
|
||||||
function get_theme_root( $stylesheet_or_template = false ) {
|
function get_theme_root( $stylesheet_or_template = false ) {
|
||||||
|
if ($stylesheet_or_template) {
|
||||||
$theme_roots = get_theme_roots();
|
$theme_roots = get_theme_roots();
|
||||||
|
|
||||||
if ( $theme_roots[$stylesheet_or_template] )
|
if ( $theme_roots[$stylesheet_or_template] )
|
||||||
$theme_root = WP_CONTENT_DIR . '/' . $theme_roots[$stylesheet_or_template];
|
$theme_root = WP_CONTENT_DIR . '/' . $theme_roots[$stylesheet_or_template];
|
||||||
else
|
else
|
||||||
$theme_root = WP_CONTENT_DIR . '/themes';
|
$theme_root = WP_CONTENT_DIR . '/themes';
|
||||||
|
} else {
|
||||||
|
$theme_root = WP_CONTENT_DIR . '/themes';
|
||||||
|
}
|
||||||
|
|
||||||
return apply_filters( 'theme_root', $theme_root );
|
return apply_filters( 'theme_root', $theme_root );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue