Support » Fixing WordPress » Excluding Category from Main Blog page

  • I’ve search the forum and every result refers to the Loop Page which has the code to do what I’m trying to do..

    I have a static front page and my main blog page on different WP Page (not the homepage). I have specific WP Page Template setup and is being called properly for the blog page and I have added the additional code to exclude posts from Category 10 on this blog page but it’s not working.

    Did something change in v2.6… has the in_category tag been deprecated or something…

    here is my loop..

    <!-- begin the loop -->
    
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <!-- If the post is in the category we want to exclude, we simply pass to the next post. -->
    <?php if (in_category('10') ) continue; ?>
    
    	<div class="post" id="post-<?php the_ID(); ?>">
    		<h1><?php the_title(); ?></h1>
    
    			<div class="entry">
    				<?php the_content('Read more...'); ?>
    			</div>
    
    	</div>
                     <br />
                     <br />
    		<?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
    		</div>
    
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php include (TEMPLATEPATH . "/searchform.php"); ?>
    
    	<?php endif; ?>
    <!-- close the loop -->

    Can someone shed some light on what I’m doing wrong?

    Thanks

  • The topic ‘Excluding Category from Main Blog page’ is closed to new replies.