diff --git a/wp-includes/theme.php b/wp-includes/theme.php
index 46c1cf1740..5bc6287d30 100644
--- a/wp-includes/theme.php
+++ b/wp-includes/theme.php
@@ -728,26 +728,30 @@ function get_raw_theme_root( $stylesheet_or_template, $no_cache = false ) {
/**
* Retrieve path to a template
*
- * Used to quickly retrieve the path of a template without including the file
- * extension. It will also check the parent theme, if the file exists, with
- * the use of {@link locate_template()}. Allows for more generic template location
+ * Used to quickly retrieve the path of file without including the file
+ * extension. It will also check the parent template, if the file exists, with
+ * the use of {@link locate_template()}. Allows for more generic file location
* without the use of the other get_*_template() functions.
*
+ * Can be used with include() or require() to retrieve path.
+ *
+ * if( '' != get_query_template( '404' ) )
+ * include( get_query_template( '404' ) );
+ *
+ * or the same can be accomplished with
+ *
+ * if( '' != get_404_template() )
+ * include( get_404_template() );
+ *
+ *
* @since 1.5.0
*
* @param string $type Filename without extension.
- * @param array $templates An optional list of template candidates
* @return string Full path to file.
*/
-function get_query_template( $type, $templates = array() ) {
+function get_query_template($type) {
$type = preg_replace( '|[^a-z0-9-]+|', '', $type );
-
- if ( empty( $templates ) )
- $templates = array("{$type}.php");
-
- $templates = apply_filters( "{$type}_template_hierarchy", $templates );
-
- return apply_filters( "{$type}_template", locate_template( $templates ) );
+ return apply_filters("{$type}_template", locate_template(array("{$type}.php")));
}
/**
@@ -807,7 +811,8 @@ function get_author_template() {
$templates[] = "author-{$author->ID}.php";
$templates[] = 'author.php';
- return get_query_template( 'author', $templates );
+ $template = locate_template( $templates );
+ return apply_filters( 'author_template', $template );
}
/**
@@ -831,7 +836,8 @@ function get_category_template() {
$templates[] = "category-{$category->term_id}.php";
$templates[] = "category.php";
- return get_query_template( 'category', $templates );
+ $template = locate_template($templates);
+ return apply_filters('category_template', $template);
}
/**
@@ -855,7 +861,8 @@ function get_tag_template() {
$templates[] = "tag-{$tag->term_id}.php";
$templates[] = "tag.php";
- return get_query_template( 'tag', $templates );
+ $template = locate_template($templates);
+ return apply_filters('tag_template', $template);
}
/**
@@ -885,7 +892,8 @@ function get_taxonomy_template() {
$templates[] = "taxonomy-$taxonomy.php";
$templates[] = "taxonomy.php";
- return get_query_template( 'taxonomy', $templates );
+ $template = locate_template($templates);
+ return apply_filters('taxonomy_template', $template);
}
/**
@@ -912,9 +920,8 @@ function get_date_template() {
* @return string
*/
function get_home_template() {
- $templates = array( 'home.php', 'index.php' );
-
- return get_query_template( 'home', $templates );
+ $template = locate_template(array('home.php', 'index.php'));
+ return apply_filters('home_template', $template);
}
/**
@@ -928,9 +935,7 @@ function get_home_template() {
* @return string
*/
function get_front_page_template() {
- $templates = array('front-page.php');
-
- return get_query_template( 'front_page', $templates );
+ return apply_filters( 'front_page_template', locate_template( array('front-page.php') ) );
}
/**
@@ -967,7 +972,7 @@ function get_page_template() {
$templates[] = "page-$id.php";
$templates[] = "page.php";
- return get_query_template( 'page', $templates );
+ return apply_filters('page_template', locate_template($templates));
}
/**
@@ -1050,13 +1055,13 @@ function get_attachment_template() {
* @return string
*/
function get_comments_popup_template() {
- $template = get_query_template( 'comments_popup', array( 'comments-popup.php' ) );
+ $template = locate_template(array("comments-popup.php"));
// Backward compat code will be removed in a future release
if ('' == $template)
$template = ABSPATH . WPINC . '/theme-compat/comments-popup.php';
- return $template;
+ return apply_filters('comments_popup_template', $template);
}
/**