Add singular.php to template hierarchy

Singular is the only template context conditional that lacks a corresponding template. This allows some themes to simplify.

Fixes #22314.
Props chipbennett.



git-svn-id: https://develop.svn.wordpress.org/trunk@32846 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Aaron Jorbin 2015-06-18 19:00:09 +00:00
parent 646c19accf
commit 301988d967
2 changed files with 16 additions and 0 deletions

View File

@ -53,6 +53,7 @@ if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) :
remove_filter('the_content', 'prepend_attachment');
elseif ( is_single() && $template = get_single_template() ) :
elseif ( is_page() && $template = get_page_template() ) :
elseif ( is_singular() && $template = get_singular_template() ) :
elseif ( is_category() && $template = get_category_template() ) :
elseif ( is_tag() && $template = get_tag_template() ) :
elseif ( is_author() && $template = get_author_template() ) :

View File

@ -382,6 +382,21 @@ function get_single_template() {
return get_query_template( 'single', $templates );
}
/**
* Retrieve path of singular template in current or parent template.
*
* The template path is filterable via the 'singular_template' hook.
*
* @since 4.3.0
*
* @see get_query_template()
*
* @return string Full path to singular template file
*/
function get_singular_template() {
return get_query_template( 'singular' );
}
/**
* Retrieve path of attachment template in current or parent template.
*