<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[17220] trunk/wp-includes/theme.php: I bungled [17214].</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/17220">17220</a></dd>
<dt>Author</dt> <dd>markjaquith</dd>
<dt>Date</dt> <dd>2011-01-04 20:55:59 +0000 (Tue, 04 Jan 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>I bungled <a href="http://trac.wordpress.org/changeset/17214">[17214]</a>. Reverting the revert, so it can be reverted properly! see <a href="http://trac.wordpress.org/ticket/14310">#14310</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesthemephp">trunk/wp-includes/theme.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesthemephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/theme.php (17219 => 17220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/theme.php        2011-01-04 19:09:20 UTC (rev 17219)
+++ trunk/wp-includes/theme.php        2011-01-04 20:55:59 UTC (rev 17220)
</span><span class="lines">@@ -728,30 +728,26 @@
</span><span class="cx"> /**
</span><span class="cx">  * Retrieve path to a template
</span><span class="cx">  *
</span><del>- * 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
</del><ins>+ * 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
</ins><span class="cx">  * without the use of the other get_*_template() functions.
</span><span class="cx">  *
</span><del>- * Can be used with include() or require() to retrieve path.
- * &lt;code&gt;
- * if( '' != get_query_template( '404' ) )
- *     include( get_query_template( '404' ) );
- * &lt;/code&gt;
- * or the same can be accomplished with
- * &lt;code&gt;
- * if( '' != get_404_template() )
- *     include( get_404_template() );
- * &lt;/code&gt;
- *
</del><span class="cx">  * @since 1.5.0
</span><span class="cx">  *
</span><span class="cx">  * @param string $type Filename without extension.
</span><ins>+ * @param array $templates An optional list of template candidates
</ins><span class="cx">  * @return string Full path to file.
</span><span class="cx">  */
</span><del>-function get_query_template($type) {
</del><ins>+function get_query_template( $type, $templates = array() ) {
</ins><span class="cx">         $type = preg_replace( '|[^a-z0-9-]+|', '', $type );
</span><del>-        return apply_filters(&quot;{$type}_template&quot;, locate_template(array(&quot;{$type}.php&quot;)));
</del><ins>+
+        if ( empty( $templates ) )
+                $templates = array(&quot;{$type}.php&quot;);
+
+        $templates = apply_filters( &quot;{$type}_template_hierarchy&quot;, $templates );
+
+        return apply_filters( &quot;{$type}_template&quot;, locate_template( $templates ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -811,8 +807,7 @@
</span><span class="cx">         $templates[] = &quot;author-{$author-&gt;ID}.php&quot;;
</span><span class="cx">         $templates[] = 'author.php';
</span><span class="cx"> 
</span><del>-        $template = locate_template( $templates );
-        return apply_filters( 'author_template', $template );
</del><ins>+        return get_query_template( 'author', $templates );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -836,8 +831,7 @@
</span><span class="cx">         $templates[] = &quot;category-{$category-&gt;term_id}.php&quot;;
</span><span class="cx">         $templates[] = &quot;category.php&quot;;
</span><span class="cx"> 
</span><del>-        $template = locate_template($templates);
-        return apply_filters('category_template', $template);
</del><ins>+        return get_query_template( 'category', $templates );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -861,8 +855,7 @@
</span><span class="cx">         $templates[] = &quot;tag-{$tag-&gt;term_id}.php&quot;;
</span><span class="cx">         $templates[] = &quot;tag.php&quot;;
</span><span class="cx"> 
</span><del>-        $template = locate_template($templates);
-        return apply_filters('tag_template', $template);
</del><ins>+        return get_query_template( 'tag', $templates );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -892,8 +885,7 @@
</span><span class="cx">         $templates[] = &quot;taxonomy-$taxonomy.php&quot;;
</span><span class="cx">         $templates[] = &quot;taxonomy.php&quot;;
</span><span class="cx"> 
</span><del>-        $template = locate_template($templates);
-        return apply_filters('taxonomy_template', $template);
</del><ins>+        return get_query_template( 'taxonomy', $templates );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -920,8 +912,9 @@
</span><span class="cx">  * @return string
</span><span class="cx">  */
</span><span class="cx"> function get_home_template() {
</span><del>-        $template = locate_template(array('home.php', 'index.php'));
-        return apply_filters('home_template', $template);
</del><ins>+        $templates = array( 'home.php', 'index.php' );
+
+        return get_query_template( 'home', $templates );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -935,7 +928,9 @@
</span><span class="cx">  * @return string
</span><span class="cx">  */
</span><span class="cx"> function get_front_page_template() {
</span><del>-        return apply_filters( 'front_page_template', locate_template( array('front-page.php') ) );
</del><ins>+        $templates = array('front-page.php');
+
+        return get_query_template( 'front_page', $templates );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -972,7 +967,7 @@
</span><span class="cx">                 $templates[] = &quot;page-$id.php&quot;;
</span><span class="cx">         $templates[] = &quot;page.php&quot;;
</span><span class="cx"> 
</span><del>-        return apply_filters('page_template', locate_template($templates));
</del><ins>+        return get_query_template( 'page', $templates );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1055,13 +1050,13 @@
</span><span class="cx">  * @return string
</span><span class="cx">  */
</span><span class="cx"> function get_comments_popup_template() {
</span><del>-        $template = locate_template(array(&quot;comments-popup.php&quot;));
</del><ins>+        $template = get_query_template( 'comments_popup', array( 'comments-popup.php' ) );
</ins><span class="cx"> 
</span><span class="cx">         // Backward compat code will be removed in a future release
</span><span class="cx">         if ('' == $template)
</span><span class="cx">                 $template = ABSPATH . WPINC . '/theme-compat/comments-popup.php';
</span><span class="cx"> 
</span><del>-        return apply_filters('comments_popup_template', $template);
</del><ins>+        return $template;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre>
</div>
</div>

</body>
</html>