* 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().
* 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()
*
$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 );
* @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.