WordPress.org

Make WordPress Core

Changeset 17214


Ignore:
Timestamp:
01/04/11 07:23:41 (3 years ago)
Author:
markjaquith
Message:

Revert [15611] for 3.1. Needs more time for peer review and iteration. see #14310

File:
1 edited

Legend:

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

    r17213 r17214  
    729729 * Retrieve path to a template 
    730730 * 
    731  * Used to quickly retrieve the path of a template without including the file 
    732  * extension. It will also check the parent theme, if the file exists, with 
    733  * the use of {@link locate_template()}. Allows for more generic template location 
     731 * Used to quickly retrieve the path of file without including the file 
     732 * extension. It will also check the parent template, if the file exists, with 
     733 * the use of {@link locate_template()}. Allows for more generic file location 
    734734 * without the use of the other get_*_template() functions. 
    735735 * 
     736 * Can be used with include() or require() to retrieve path. 
     737 * <code> 
     738 * if( '' != get_query_template( '404' ) ) 
     739 *     include( get_query_template( '404' ) ); 
     740 * </code> 
     741 * or the same can be accomplished with 
     742 * <code> 
     743 * if( '' != get_404_template() ) 
     744 *     include( get_404_template() ); 
     745 * </code> 
     746 * 
    736747 * @since 1.5.0 
    737748 * 
    738749 * @param string $type Filename without extension. 
    739  * @param array $templates An optional list of template candidates 
    740750 * @return string Full path to file. 
    741751 */ 
    742 function get_query_template( $type, $templates = array() ) { 
     752function get_query_template($type) { 
    743753    $type = preg_replace( '|[^a-z0-9-]+|', '', $type ); 
    744  
    745     if ( empty( $templates ) ) 
    746         $templates = array("{$type}.php"); 
    747  
    748     $templates = apply_filters( "{$type}_template_hierarchy", $templates ); 
    749  
    750     return apply_filters( "{$type}_template", locate_template( $templates ) ); 
     754    return apply_filters("{$type}_template", locate_template(array("{$type}.php"))); 
    751755} 
    752756 
     
    808812    $templates[] = 'author.php'; 
    809813 
    810     return get_query_template( 'author', $templates ); 
     814    $template = locate_template( $templates ); 
     815    return apply_filters( 'author_template', $template ); 
    811816} 
    812817 
     
    832837    $templates[] = "category.php"; 
    833838 
    834     return get_query_template( 'category', $templates ); 
     839    $template = locate_template($templates); 
     840    return apply_filters('category_template', $template); 
    835841} 
    836842 
     
    856862    $templates[] = "tag.php"; 
    857863 
    858     return get_query_template( 'tag', $templates ); 
     864    $template = locate_template($templates); 
     865    return apply_filters('tag_template', $template); 
    859866} 
    860867 
     
    886893    $templates[] = "taxonomy.php"; 
    887894 
    888     return get_query_template( 'taxonomy', $templates ); 
     895    $template = locate_template($templates); 
     896    return apply_filters('taxonomy_template', $template); 
    889897} 
    890898 
     
    913921 */ 
    914922function get_home_template() { 
    915     $templates = array( 'home.php', 'index.php' ); 
    916  
    917     return get_query_template( 'home', $templates ); 
     923    $template = locate_template(array('home.php', 'index.php')); 
     924    return apply_filters('home_template', $template); 
    918925} 
    919926 
     
    929936 */ 
    930937function get_front_page_template() { 
    931     $templates = array('front-page.php'); 
    932  
    933     return get_query_template( 'front_page', $templates ); 
     938    return apply_filters( 'front_page_template', locate_template( array('front-page.php') ) ); 
    934939} 
    935940 
     
    968973    $templates[] = "page.php"; 
    969974 
    970     return get_query_template( 'page', $templates ); 
     975    return apply_filters('page_template', locate_template($templates)); 
    971976} 
    972977 
     
    10511056 */ 
    10521057function get_comments_popup_template() { 
    1053     $template = get_query_template( 'comments_popup', array( 'comments-popup.php' ) ); 
     1058    $template = locate_template(array("comments-popup.php")); 
    10541059 
    10551060    // Backward compat code will be removed in a future release 
     
    10571062        $template = ABSPATH . WPINC . '/theme-compat/comments-popup.php'; 
    10581063 
    1059     return $template; 
     1064    return apply_filters('comments_popup_template', $template); 
    10601065} 
    10611066 
Note: See TracChangeset for help on using the changeset viewer.