Make WordPress Core

Ticket #26742: 26742.3.patch

File 26742.3.patch, 7.7 KB (added by DrewAPicture, 12 years ago)

@see + returns + alternative filter description

  • src/wp-includes/template.php

     
    1818 *
    1919 * @param string $type Filename without extension.
    2020 * @param array $templates An optional list of template candidates
    21  * @return string Full path to file.
     21 * @return string Full path to template file.
    2222 */
    2323function get_query_template( $type, $templates = array() ) {
    2424        $type = preg_replace( '|[^a-z0-9-]+|', '', $type );
     
    4444/**
    4545 * Retrieve path of index template in current or parent template.
    4646 *
     47 * The template path is filterable via the 'index_template' hook.
     48 *
    4749 * @since 3.0.0
    4850 *
    49  * @return string
     51 * @see get_query_template()
     52 *
     53 * @return string Full path to index template file.
    5054 */
    5155function get_index_template() {
    5256        return get_query_template('index');
     
    5559/**
    5660 * Retrieve path of 404 template in current or parent template.
    5761 *
     62 * The template path is filterable via the '404_template' hook.
     63 *
    5864 * @since 1.5.0
    5965 *
    60  * @return string
     66 * @see get_query_template()
     67 *
     68 * @return string Full path to 404 template file.
    6169 */
    6270function get_404_template() {
    6371        return get_query_template('404');
     
    6674/**
    6775 * Retrieve path of archive template in current or parent template.
    6876 *
     77 * The template path is filterable via the 'archive_template' hook.
     78 *
    6979 * @since 1.5.0
    7080 *
    71  * @return string
     81 * @see get_query_template()
     82 *
     83 * @return string Full path to archive template file.
    7284 */
    7385function get_archive_template() {
    7486        $post_types = array_filter( (array) get_query_var( 'post_type' ) );
     
    8799/**
    88100 * Retrieve path of post type archive template in current or parent template.
    89101 *
     102 * The template path is filterable via the 'archive_template' hook.
     103 *
    90104 * @since 3.7.0
    91105 *
    92  * @return string
     106 * @see get_archive_template()
     107 *
     108 * @return string Full path to archive template file.
    93109 */
    94110function get_post_type_archive_template() {
    95111        $post_type = get_query_var( 'post_type' );
     
    106122/**
    107123 * Retrieve path of author template in current or parent template.
    108124 *
     125 * The template path is filterable via the 'author_template' hook.
     126 *
    109127 * @since 1.5.0
    110128 *
    111  * @return string
     129 * @see get_query_template()
     130 *
     131 * @return string Full path to author template file.
    112132 */
    113133function get_author_template() {
    114134        $author = get_queried_object();
     
    131151 * trying category ID, for example 'category-1.php', and will finally fall back to category.php
    132152 * template, if those files don't exist.
    133153 *
     154 * The template path is filterable via the 'category_template' hook.
     155 *
    134156 * @since 1.5.0
    135  * @uses apply_filters() Calls 'category_template' on file path of category template.
    136157 *
    137  * @return string
     158 * @see get_query_template()
     159 *
     160 * @return string Full path to category template file.
    138161 */
    139162function get_category_template() {
    140163        $category = get_queried_object();
     
    157180 * trying tag ID, for example 'tag-1.php', and will finally fall back to tag.php
    158181 * template, if those files don't exist.
    159182 *
     183 * The template path is filterable via the 'tag_template' hook.
     184 *
    160185 * @since 2.3.0
    161  * @uses apply_filters() Calls 'tag_template' on file path of tag template.
    162186 *
    163  * @return string
     187 * @see get_query_template()
     188 *
     189 * @return string Full path to tag template file.
    164190 */
    165191function get_tag_template() {
    166192        $tag = get_queried_object();
     
    188214 * template is used. If none of the files exist, then it will fall back on to
    189215 * index.php.
    190216 *
     217 * The template path is filterable via the 'taxonomy_template' hook.
     218 *
    191219 * @since 2.5.0
    192  * @uses apply_filters() Calls 'taxonomy_template' filter on found path.
    193220 *
    194  * @return string
     221 * @see get_query_template()
     222 *
     223 * @return string Full path to taxonomy template file.
    195224 */
    196225function get_taxonomy_template() {
    197226        $term = get_queried_object();
     
    211240/**
    212241 * Retrieve path of date template in current or parent template.
    213242 *
     243 * The template path is filterable via the 'date_template' hook.
     244 *
    214245 * @since 1.5.0
    215246 *
    216  * @return string
     247 * @see get_query_template()
     248 *
     249 * @return string Full path to date template file.
    217250 */
    218251function get_date_template() {
    219252        return get_query_template('date');
     
    223256 * Retrieve path of home template in current or parent template.
    224257 *
    225258 * This is the template used for the page containing the blog posts.
    226  *
    227259 * Attempts to locate 'home.php' first before falling back to 'index.php'.
    228260 *
     261 * The template path is filterable via the 'home_template' hook.
     262 *
    229263 * @since 1.5.0
    230  * @uses apply_filters() Calls 'home_template' on file path of home template.
    231264 *
    232  * @return string
     265 * @see get_query_template()
     266 *
     267 * @return string Full path to home template file.
    233268 */
    234269function get_home_template() {
    235270        $templates = array( 'home.php', 'index.php' );
     
    240275/**
    241276 * Retrieve path of front-page template in current or parent template.
    242277 *
    243  * Looks for 'front-page.php'.
     278 * Looks for 'front-page.php'. The template path is filterable via the
     279 * 'front_page_template' hook.
    244280 *
    245281 * @since 3.0.0
    246  * @uses apply_filters() Calls 'front_page_template' on file path of template.
    247282 *
    248  * @return string
     283 * @see get_query_template()
     284 *
     285 * @return string Full path to front page template file.
    249286 */
    250287function get_front_page_template() {
    251288        $templates = array('front-page.php');
     
    260297 * Then will search for 'page-{slug}.php', followed by 'page-{id}.php',
    261298 * and finally 'page.php'.
    262299 *
     300 * The template path is filterable via the 'page_template' hook.
     301 *
    263302 * @since 1.5.0
    264303 *
    265  * @return string
     304 * @see get_query_template()
     305 *
     306 * @return string Full path to page template file.
    266307 */
    267308function get_page_template() {
    268309        $id = get_queried_object_id();
     
    291332/**
    292333 * Retrieve path of paged template in current or parent template.
    293334 *
     335 * The template path is filterable via the 'paged_template' hook.
     336 *
    294337 * @since 1.5.0
    295338 *
    296  * @return string
     339 * @see get_query_template()
     340 *
     341 * @return string Full path to paged template file.
    297342 */
    298343function get_paged_template() {
    299344        return get_query_template('paged');
     
    302347/**
    303348 * Retrieve path of search template in current or parent template.
    304349 *
     350 * The template path is filterable via the 'search_template' hook.
     351 *
    305352 * @since 1.5.0
    306353 *
    307  * @return string
     354 * @see get_query_template()
     355 *
     356 * @return string Full path to search template file.
    308357 */
    309358function get_search_template() {
    310359        return get_query_template('search');
     
    313362/**
    314363 * Retrieve path of single template in current or parent template.
    315364 *
     365 * The template path is filterable via the 'single_template' hook.
     366 *
    316367 * @since 1.5.0
    317368 *
    318  * @return string
     369 * @see get_query_template()
     370 *
     371 * @return string Full path to single template file.
    319372 */
    320373function get_single_template() {
    321374        $object = get_queried_object();
     
    340393 * Some examples for the 'text/plain' mime type are 'text.php', 'plain.php', and
    341394 * finally 'text_plain.php'.
    342395 *
     396 * The template path is filterable via the 'attachment_template' hook.
     397 *
    343398 * @since 2.0.0
    344399 *
    345  * @return string
     400 * @see get_query_template()
     401 *
     402 * @return string Full path to attachment template file.
    346403 */
    347404function get_attachment_template() {
    348405        global $posts;
     
    371428 * Checks for comment popup template in current template, if it exists or in the
    372429 * parent template.
    373430 *
     431 * The template path is filterable via the 'comments_popup_template' hook.
     432 *
    374433 * @since 1.5.0
    375  * @uses apply_filters() Calls 'comments_popup_template' filter on path.
    376434 *
    377  * @return string
     435 * @see get_query_template()
     436 *
     437 * @return string Full path to comments popup template file.
    378438 */
    379439function get_comments_popup_template() {
    380440        $template = get_query_template( 'comments_popup', array( 'comments-popup.php' ) );