Forums

show only specific category's post on index.php but won't update? (2 posts)

  1. arcab4
    Member
    Posted 4 years ago #

    hello,

    i am using this code:

    <?php if (is_home()) {query_posts("cat=3");}?>
    		<?php if(have_posts()): ?>
    			<?php while(have_posts()) : the_post();?>
    
    	  		<div class="post" id="post-<?php the_ID(); ?>">
    		  			<div class="title">
    		  			<h2><a href="<?php the_permalink(); ?>" title="Permanent link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    					<?php the_time("M"); ?> <?php the_time("d"); ?>, <?php the_time("Y"); ?>
    	  				<span class="comments"><?php edit_post_link('Edit Post', '<span class="editlink">', '</span>'); ?>		</span>
    		  		</div>
    	  			<div class="entry">
    	  				<?php the_content('Read the rest of this entry &raquo;') ?>
    					</div>

    to show only posts that are in category "3" on my homepage.

    this works great until i noticed when i click at the bottom to see previous entries...it just shows the same results over and over again.

    it appears that this line is causing the problem. works fine when i remove it but the results are wrong.

    <?php if (is_home()) {query_posts("cat=3");}?>

  2. arcab4
    Member
    Posted 4 years ago #

    sorry for the scrolling..hope this helps..

    <?php if (is_home()) {query_posts("cat=3");}?>
    <?php if(have_posts()): ?>
    <?php while(have_posts()) : the_post();?>
    
    <div class="post" id="post-<?php the_ID(); ?>">
    <div class="title">
    <h2><a href="<?php the_permalink(); ?>" title="Permanent link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    <?php the_time("M"); ?> <?php the_time("d"); ?>, <?php the_time("Y"); ?>
    <span class="comments"><?php edit_post_link('Edit Post', '<span class="editlink">', '</span>'); ?>		</span>
    </div>
    <div class="entry">
    <?php the_content('Read the rest of this entry &raquo;') ?>
    </div>
    
    </div>

Topic Closed

This topic has been closed to new replies.

About this Topic