Skip to content

Instantly share code, notes, and snippets.

@fomigo
Created May 31, 2014 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fomigo/ee7e8f97ad7ef5f8acd3 to your computer and use it in GitHub Desktop.
Save fomigo/ee7e8f97ad7ef5f8acd3 to your computer and use it in GitHub Desktop.
wp: single-{id}.php
<?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