WordPress is a an open source software having powerful code base with the lot of options. Normally WordPress has great template hierarchy in order to design a versatile blog or a business website. You may have different single template per post very easily by following the template hierarchy of singular page i.e. single-post.php in your theme.
But today, we are going to share a WordPress hack to use different single template for different categories. You may have different single page for a category ‘wordpress’ and a different single page for ‘tutorials’ and so on. Let have a look,
/** How To Use Different Single Template Per Category */
if( in_category( 'wordpress' ) ):
get_template_part( 'single', 'wordpress' );
elseif( in_category( 'tutorials' ) ):
get_template_part( 'single', 'tutorials' );
get_template_part( 'single', 'all' );
Place the above snippet in your single.php template. You may also be interested to have another hack about Remove #more Anchor WordPress.