Support » Plugins » Only Display posts in category

  • I have posted this before but with no luck, wonder if someone can help me. This is the code for my single post file, It displays one post in detail at a time with left and right arrows to display the next post and previous post.

    I have posts under different categories, is it possible to amend this code so that it cycles through posts excluding all posts in ‘news’ category. My brain is fried 🙂

    Many Thanks

    <?php get_header(); ?>
    
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <div id="post-<?php the_ID(); ?>"
    <?php post_class(); ?>>
    				<?php if ( has_post_thumbnail() ) { ?>
                 <?php } ?>
           			<div class="gridly-copy">
                    <h1><?php the_title(); ?> </h1>
    
               	<div class="detail"><?php the_content(); ?></div>
                     <?php the_tags(); ?>
    
                    <div class="clear"></div>
    				<?php comments_template(); ?>
                    </div>
    
           </div>
    
    		<?php endwhile; endif; ?>
    
           <div class="post-nav">
                   <div class="post-prev"><?php previous_post_link('%link'); ?> </div>
    			   <div class="post-next"><?php next_post_link('%link'); ?></div>
            </div>      
    
    <?php get_footer(); ?>
  • The topic ‘Only Display posts in category’ is closed to new replies.