WordPress.org

Make WordPress Core

Ticket #10467: parent_theme_root-2.patch

File parent_theme_root-2.patch, 1.2 KB (added by apeatling, 11 years ago)
  • wp-includes/theme.php

     
    310310                return $themes;
    311311
    312312        sort($theme_files);
     313       
     314        /* Set the original theme_root and theme_loc values so they can be unfiltered at the start of each iteration. */
     315        $orig_theme_root = $theme_root;
     316        $orig_theme_loc = $theme_loc;
    313317
    314318        foreach ( (array) $theme_files as $theme_file ) {
     319                /* Reset the theme_root and theme_loc values as they may have been filtered in the previous iteration. */
     320                $theme_root = $orig_theme_root;
     321                $theme_loc = $orig_theme_loc;
     322               
    315323                if ( !is_readable("$theme_root/$theme_file") ) {
    316324                        $wp_broken_themes[$theme_file] = array('Name' => $theme_file, 'Title' => $theme_file, 'Description' => __('File not readable.'));
    317325                        continue;
     
    348356                }
    349357
    350358                $template = trim($template);
    351 
     359               
     360                $theme_root = apply_filters( 'parent_theme_root_' . $template, $theme_root );
     361                $theme_loc = apply_filters( 'parent_theme_loc_' . $template, $theme_loc );
     362               
    352363                if ( !file_exists("$theme_root/$template/index.php") ) {
    353364                        $parent_dir = dirname(dirname($theme_file));
    354365                        if ( file_exists("$theme_root/$parent_dir/$template/index.php") ) {