Support » Fixing WordPress » Losing posts when adding a category filter

  • Hi,
    I’m using the code below, and added in the 3rd line “<?php if (in_category(1)) : ?>”, and then also <?php endif; ?>. After I add it, I only get 10 – (# of posts not in category 1) posts displayed on the page. Can you tell me what I can do to get the standard 10 posts per page that I’ve chosen in the options menu? Thanks and sorry for being such a novice!

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php if (in_category(1)) : ?>
    <?php $custom_fields = get_post_custom(); //custom fields ?>
    	<hr class="low" />
    	<div class="entry">
    <h3><a href="<?php the_permalink() ?>" title="Permalink"><?php the_title(); ?></a></h3>
    		<?php ($post->post_excerpt != "")? the_excerpt() : the_content(); ?>
    		<p class="info"><?php if ($post->post_excerpt != "") { ?><a href="<?php the_permalink() ?>" class="more">Continue Reading</a><?php } ?>
       		<?php comments_popup_link('Add comment', '1 comment', '% comments', 'commentlink', ''); ?>
       		<em class="date"><?php the_time('F jS, Y') ?></em><!-- at <?php the_time('h:ia')  ?>-->
       		<em class="author">by: <?php the_author_posts_link('namefl'); ?></em>
       		<?php edit_post_link('Edit','<span class="editlink">','</span>'); ?>
    <?php endif; ?>
    <?php endwhile; ?>
    	<span class="next"><?php previous_posts_link('Next Posts') ?></span>
    	<span class="previous"><?php next_posts_link('Previous Posts') ?></span>
    <?php else : ?>
    	<h2>Not Found</h2>
    	<p>Sorry, but you are looking for something that isn't here.</p>
    <?php endif; ?>
  • The topic ‘Losing posts when adding a category filter’ is closed to new replies.