Make WordPress Core

Changeset 12043


Ignore:
Timestamp:
10/15/2009 08:45:32 PM (15 years ago)
Author:
westi
Message:

Restore the functionality of the theme_root filter. See #10467.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r12042 r12043  
    262262        return $wp_themes;
    263263
    264     /* Register wp-content/themes as a theme directory */
    265     register_theme_directory( 'themes' );
     264    /* Register the default root as a theme directory */
     265    register_theme_directory( get_theme_root() );
    266266
    267267    if ( !$theme_files = search_theme_directories() )
     
    494494
    495495/**
    496  * Register a directory that contains themes relative to the content directory.
     496 * Register a directory that contains themes.
    497497 *
    498498 * @since 2.9.0
    499499 *
     500 * @param string $directory Either the full filesystem path to a theme folder or a folder within WP_CONTENT_DIR
    500501 * @return bool
    501502 */
    502 function register_theme_directory( $directory ) {
     503function register_theme_directory( $directory) {
    503504    global $wp_theme_directories;
    504 
    505     /* The theme directory should be relative to the content directory */
    506     $registered_directory = WP_CONTENT_DIR . '/' . $directory;
    507 
     505   
     506    /* If this folder does not exist, return and do not register */
     507    if ( !file_exists( $directory ) )
     508            /* Try prepending as the theme directory could be relative to the content directory */
     509        $registered_directory = WP_CONTENT_DIR . '/' . $directory;
     510    else
     511        $registered_directory = $directory;
     512   
    508513    /* If this folder does not exist, return and do not register */
    509514    if ( !file_exists( $registered_directory ) )
     
    524529function search_theme_directories() {
    525530    global $wp_theme_directories, $wp_broken_themes;
    526 
    527531    if ( empty( $wp_theme_directories ) )
    528532        return false;
     
    610614 */
    611615function get_theme_root( $stylesheet_or_template = false ) {
    612     $theme_roots = get_theme_roots();
    613 
    614     if ( $theme_roots[$stylesheet_or_template] )
    615         $theme_root = WP_CONTENT_DIR . '/' . $theme_roots[$stylesheet_or_template];
    616     else
     616    if ($stylesheet_or_template) {
     617        $theme_roots = get_theme_roots();
     618       
     619        if ( $theme_roots[$stylesheet_or_template] )
     620            $theme_root = WP_CONTENT_DIR . '/' . $theme_roots[$stylesheet_or_template];
     621        else
     622            $theme_root = WP_CONTENT_DIR . '/themes';
     623    } else {
    617624        $theme_root = WP_CONTENT_DIR . '/themes';
    618 
     625    }
     626   
    619627    return apply_filters( 'theme_root', $theme_root );
    620628}
Note: See TracChangeset for help on using the changeset viewer.