WordPress.org

Ready to get started?Download WordPress

Forums

Losing posts when adding a category filter (1 post)

  1. clammer
    Member
    Posted 6 years ago #

    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>'); ?>
       		</p>
    
    	</div>
    
    <?php endif; ?>
    <?php endwhile; ?>
    
    	<p>
    	<span class="next"><?php previous_posts_link('Next Posts') ?></span>
    	<span class="previous"><?php next_posts_link('Previous Posts') ?></span>
    	</p>
    
    <?php else : ?>
    
    	<h2>Not Found</h2>
    	<p>Sorry, but you are looking for something that isn't here.</p>
    <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags