Make WordPress Core

Changeset 34800


Ignore:
Timestamp:
10/03/2015 02:59:46 PM (9 years ago)
Author:
SergeyBiryukov
Message:

Add single-{post_type}-{post_name}.php to the top of the template hierarchy for single posts.

This is consistent with page and taxonomy templates, which support slugs as well.

Props ericjuden, johnbillion.
Fixes #18859.

File:
1 edited

Legend:

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

    r33274 r34800  
    381381 *
    382382 * @since 1.5.0
     383 * @since 4.4.0 `single-{post_type}-{post_name}.php` was added to the top of the template hierarchy.
    383384 *
    384385 * @see get_query_template()
     
    391392    $templates = array();
    392393
    393     if ( ! empty( $object->post_type ) )
     394    if ( ! empty( $object->post_type ) ) {
     395        $templates[] = "single-{$object->post_type}-{$object->post_name}.php";
    394396        $templates[] = "single-{$object->post_type}.php";
     397    }
     398
    395399    $templates[] = "single.php";
    396400
Note: See TracChangeset for help on using the changeset viewer.