]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/template.php
WordPress 4.4
[autoinstalls/wordpress.git] / wp-includes / template.php
index 3e4e9a403ed441395366fe4844b9020ffb8a1aa0..45d1db0c0fd5c3b4942da9cefe16831f9cbb9c0c 100644 (file)
@@ -35,6 +35,9 @@ function get_query_template( $type, $templates = array() ) {
         * extension and any non-alphanumeric characters delimiting words -- of the file to load.
         * This hook also applies to various types of files loaded as part of the Template Hierarchy.
         *
+        * Possible values for `$type` include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date',
+        * 'home', 'front_page', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.
+        *
         * @since 1.5.0
         *
         * @param string $template Path to the template. See locate_template().
@@ -380,6 +383,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 +394,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 );
@@ -534,7 +541,7 @@ function locate_template($template_names, $load = false, $require_once = true )
  * @global string     $wp_version
  * @global WP         $wp
  * @global int        $id
- * @global object     $comment
+ * @global WP_Comment $comment
  * @global int        $user_ID
  *
  * @param string $_template_file Path to template file.