Created
October 3, 2013 15:38
-
-
Save gezimbasha/6811910 to your computer and use it in GitHub Desktop.
Adds the single-id.php to WordPress Template Hierarchy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_single_template() { | |
$object = get_queried_object(); | |
$id = get_queried_object_id(); | |
$templates = array(); | |
if ( $object ) | |
$templates[] = "single-{$object->post_type}.php"; | |
if ( $id ) | |
$templates[] = "single-$id.php"; | |
$templates[] = "single.php"; | |
return get_query_template( 'single', $templates ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment