public
Last active

Add this to your functions.php or functionality plugin

  • Download Gist
single-id-template.php
PHP
1 2 3 4 5 6
<?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' );

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.