I am showing latest 5 posts in category.php but want to hide (or do not want to show ) posts from few subcategories under particular category.
Example : If I am in category C that has sub-categories c1, c2, c3, c4 and c5. I want to display latest 5 posts except posts in subcategory cat-3
I hv tried it but the problem is that the loop runs 5 times and counts the skipped posts as well, though they are not displayed. So if there are 4 latest posts from c3, the category page shows just 1 latest post , since it skips the subcategory c3's 4 latest posts.
here the code I am using
<?php if (have_posts()) : ?>
<? if (is_category('8') or is_category('2')) { ?>
<?php while (have_posts()) : the_post(); ?>
<? if ((! in_category('14')) and (! in_category('10')) and (! in_category('16'))) {?>
<div id="category">
<!-- <h2 id="post-<?php the_ID(); ?>"> -->
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php single_cat_title('');?> <?php the_title(); ?>">
<?php the_title(); ?></a></h2>
<?php the_excerpt(); ?> <?php the_time('F jS, Y') ?> <a href="<?php the_permalink() ?>" rel="bookmark">[ ... Read more ...]</a>
<!-- by <?php the_author() ?> -->
</div>
<? } ?>
<?php endwhile; ?>
<?}?>