How to have multiple blogpost styles
-
Hey there hope you are doing well!
I have run into a bit of a situation. There are 4 categories on my site. For category 1 and 2, I want to use the post template defined in my ‘content-single.php’.
And for the other two categories, I want to be able to use a different template, for example, ‘content-new.php’.
This is my code in the single.php file (The template for displaying all single posts.)
<?php
while ( have_posts() ) : the_post();get_template_part( ‘template-parts/content-single’, get_post_format() ); ?>
<section class=”white-background”>
<?php // If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;endwhile; // End of the loop.
?>// My site is at technobyte.org
- The topic ‘How to have multiple blogpost styles’ is closed to new replies.