Last active
May 11, 2017 04:52
-
-
Save infoscigeek/e9ed9b4fc1da428049e6da058fdae34f to your computer and use it in GitHub Desktop.
Category dependent post templates.
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 | |
//by https://stanhub.com/about-stan-kostadinov/ | |
//works as expected | |
function get_custom_cat_template($single_template) { | |
global $post; | |
if ( in_category( 'category-name' )) { | |
$single_template = dirname( __FILE__ ) . '/single-template.php'; | |
} | |
return $single_template; | |
} | |
add_filter( "single_template", "get_custom_cat_template" ) ; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment