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. Built from https://develop.svn.wordpress.org/trunk@34800 git-svn-id: http://core.svn.wordpress.org/trunk@34765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9dc1a858f8
commit
3792591dfb
|
@ -380,6 +380,7 @@ function get_search_template() {
|
|||
* e.g. 'single_template'.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 4.4.0 `single-{post_type}-{post_name}.php` was added to the top of the template hierarchy.
|
||||
*
|
||||
* @see get_query_template()
|
||||
*
|
||||
|
@ -390,8 +391,11 @@ function get_single_template() {
|
|||
|
||||
$templates = array();
|
||||
|
||||
if ( ! empty( $object->post_type ) )
|
||||
if ( ! empty( $object->post_type ) ) {
|
||||
$templates[] = "single-{$object->post_type}-{$object->post_name}.php";
|
||||
$templates[] = "single-{$object->post_type}.php";
|
||||
}
|
||||
|
||||
$templates[] = "single.php";
|
||||
|
||||
return get_query_template( 'single', $templates );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-alpha-34799';
|
||||
$wp_version = '4.4-alpha-34800';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue