Created
December 1, 2012 20:22
-
-
Save maor/4184748 to your computer and use it in GitHub Desktop.
Add this to your functions.php or functionality plugin
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
<?php | |
function my_single_template_by_post_id( $located_template ) { | |
return locate_template( array( sprintf( "single-%d.php", absint( get_the_ID() ) ), $located_template ) ); | |
} | |
add_filter( 'single_template', 'my_single_template_by_post_id' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works Great just you need to create a file in your main template folder with name single-(your post id here).php
Thanks very useful if you want to test some new single.php templates on working website