WordPress.org

Make WordPress Core

Changeset 28563


Ignore:
Timestamp:
05/23/2014 08:11:08 PM (7 years ago)
Author:
wonderboymusic
Message:

Replaces all uses of TEMPLATEPATH and STYLESHEETPATH in core with get_template_directory() and get_stylesheet_directory().

Add @deprecated annotations to TEMPLATEPATH and STYLESHEETPATH definitions.

Props obenland, aaroncampbell.
Fixes #18298.

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r28558 r28563  
    10501050 *
    10511051 * The $file path is passed through a filter hook called, 'comments_template'
    1052  * which includes the TEMPLATEPATH and $file combined. Tries the $filtered path
     1052 * which includes the template path and $file combined. Tries the $filtered path
    10531053 * first and if it fails it will require the default comment template from the
    10541054 * default theme. If either does not exist, then the WordPress process will be
     
    11351135        define('COMMENTS_TEMPLATE', true);
    11361136
    1137     $theme_template = STYLESHEETPATH . $file;
     1137    $theme_template = get_stylesheet_directory() . $file;
    11381138    /**
    11391139     * Filter the path to the theme template file used for the comments template.
     
    11461146    if ( file_exists( $include ) )
    11471147        require( $include );
    1148     elseif ( file_exists( TEMPLATEPATH . $file ) )
    1149         require( TEMPLATEPATH . $file );
     1148    elseif ( file_exists( get_template_directory() . $file ) )
     1149        require( get_template_directory() . $file );
    11501150    else // Backward compat code will be removed in a future release
    11511151        require( ABSPATH . WPINC . '/theme-compat/comments.php');
  • trunk/src/wp-includes/default-constants.php

    r26868 r28563  
    297297     * Filesystem path to the current active template directory
    298298     * @since 1.5.0
     299     * @deprecated 4.0
     300     * @deprecated Use get_template_directory()
    299301     */
    300302    define('TEMPLATEPATH', get_template_directory());
     
    303305     * Filesystem path to the current active template stylesheet directory
    304306     * @since 2.1.0
     307     * @deprecated 4.0
     308     * @deprecated Use get_stylesheet_directory()
    305309     */
    306310    define('STYLESHEETPATH', get_stylesheet_directory());
  • trunk/src/wp-includes/template.php

    r26906 r28563  
    450450 * Retrieve the name of the highest priority template file that exists.
    451451 *
    452  * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which
     452 * Searches in the stylesheet path before template path so that themes which
    453453 * inherit from a parent theme can just overload one file.
    454454 *
     
    465465        if ( !$template_name )
    466466            continue;
    467         if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {
    468             $located = STYLESHEETPATH . '/' . $template_name;
     467        if ( file_exists( get_stylesheet_directory() . '/' . $template_name ) ) {
     468            $located = get_stylesheet_directory() . '/' . $template_name;
    469469            break;
    470         } else if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) {
    471             $located = TEMPLATEPATH . '/' . $template_name;
     470        } else if ( file_exists( get_template_directory() . '/' . $template_name ) ) {
     471            $located = get_template_directory() . '/' . $template_name;
    472472            break;
    473473        }
  • trunk/src/wp-includes/theme.php

    r28337 r28563  
    129129 **/
    130130function is_child_theme() {
    131     return ( TEMPLATEPATH !== STYLESHEETPATH );
     131    return get_template_directory() !== get_stylesheet_directory();
    132132}
    133133
  • trunk/src/wp-settings.php

    r27999 r28563  
    323323// Load the functions for the active theme, for both parent and child theme if applicable.
    324324if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) {
    325     if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
    326         include( STYLESHEETPATH . '/functions.php' );
    327     if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
    328         include( TEMPLATEPATH . '/functions.php' );
     325    if ( is_child_theme() && file_exists( get_stylesheet_directory() . '/functions.php' ) ) {
     326        include get_stylesheet_directory() . '/functions.php';
     327    }
     328    if ( file_exists( get_template_directory() . '/functions.php' ) ) {
     329        include get_template_directory() . '/functions.php';
     330    }
    329331}
    330332
Note: See TracChangeset for help on using the changeset viewer.