Question about excluding a category
-
I currently have my blog set to show 10 posts per page. Within my loop I’m telling it to exclude posts from the category ID 17 (News). Now when I view my blog I have less posts showing up according to how many “News” posts should have been there as well.
Example:
My 4 most recent posts are “News”. (Being used in a “News” specific page). So my blog only shows 6 posts on the 1st page as opposed to the 10 I want.How can I exclude category 17 and still always get 10 posts per page?
Here’s my current loop.
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php /* '17' is the ID for the news category which we do not want to display within the blog. So if the cateogry is '17' continue to the next post. */ if (in_category('17')) continue; ?> <li id="post-<?php the_ID(); ?>" class="clear"> <div class="author"> <img src="<?php bloginfo('template_directory') ?>/images/authors/<?php the_author_ID()?>.jpg" alt="<?php the_author(); ?>" width="86" height="94" /> <?php the_author_posts_link( null,'mar_10_b'); ?> </div> <div class="preview"> <p class="date orange_14px"><?php the_time('F j, Y'); ?></p> <h2 class="red_18px"><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <p><?php the_excerpt(); ?></p> <div class="clear"> <a href="<?php the_permalink() ?>" title="Read More">Read More »</a> <a href="#" title="Share This Post" class="share">Share</a> <a href="<?php the_permalink() ?>#view_comments" title="View Comments" class="comments"><?php comments_number('No Comments', '1 Comment', '% Comments' );?></a> </div> </div> </li> <li class="rule"></li> <?php endwhile; ?> <li class="pagination clear"> <?php next_posts_link('Previous Entries »', 0, 'prev') ?> <?php previous_posts_link('« Newer Entries', 0, 'next') ?> </li> </ul> <?php endif; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Question about excluding a category’ is closed to new replies.