Created
January 16, 2025 14:50
-
-
Save drivendevelopment/30a1c9be288155753682e800a21b3a0a to your computer and use it in GitHub Desktop.
Override the location of the post template.
This file contains hidden or 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 | |
| /** | |
| * Load a custom template for single posts. | |
| */ | |
| add_filter( 'template_include', function( $template ){ | |
| if ( is_single() && 'post' == get_post_type() ) { | |
| $template = dirname( __FILE__ ) . '/templates/single-post.php'; | |
| } | |
| return $template; | |
| } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment