WordPress.org

Ready to get started?Download WordPress

Forums

page navi only displays same posts (5 posts)

  1. volume2
    Member
    Posted 5 years ago #

    hi everyone
    my older entries and previous entries links do not work, when clicked they only repeat the same 5 posts
    my theme is the revolution theme and i dont think it was coded for page navigation so i am sure i am missing some code
    eventually i want to be able to use the pagenavi plugin but so far it gives the same results as the default page navigation

    <?php get_header(); ?>
    
    <div id="content">
    
    	<div id="homepage">
    
    		<div id="homepageleft">
    
    			<!--This section is currently pulling category ID #1, and can be switched by changing the cat=1 to show whatever category ID you would like in this area.-->
    
    			<div class="featured">
    
    				<?php $recent = new WP_Query("cat=5,9,3"); while($recent->have_posts()) : $recent->the_post();?>
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    				<?php the_content(__('Read the story &raquo;'));?><div style="clear:both;"></div>
    <div style="text-align:right;"><?php comments_popup_link('Leave a Comment ', '1 Comment ', '% Comments '); ?><img title="Comment Now" src="http://greenerbuyer.com/wp-content/uploads/wp-comments.png" alt="comment" width="24" height="24" />&nbsp;</br></div>
    				<?php endwhile; ?><h3>Cruise through more</h3><?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>  &nbsp;</br>
    <div id="nav-below" class="navigation">
    
    			<?php next_posts_link('&laquo; Previous Entries') ?> 
    
    <div class="alignright"><?php posts_nav_link('','Next Entries &raquo;','') ?></div>
    			</div>
    
    </div>
  2. Lester Chan
    Member
    Posted 5 years ago #

    PageNavi will only work with the default loop and not a new loop as defined in <?php $recent = new WP_Query("cat=5,9,3"); while($recent->have_posts()) : $recent->the_post();?>

  3. volume2
    Member
    Posted 5 years ago #

    how can i convert this back to a default loop

  4. Lester Chan
    Member
    Posted 5 years ago #

    From your code, it is not possible as there is already a default loop running. The code you posted just display the featured posts

  5. elorgwhee
    Member
    Posted 5 years ago #

    Thanks GamerZ for replying to this. I'm running into this same issue and have been having a hard time trying to find a solution.

    I just want to be able to have my front page display only the items in the "News" category, and /Journal to display items in the "Journal" category, etc. Apparently when I filter the loop, the pagination breaks... =\

Topic Closed

This topic has been closed to new replies.

About this Topic