WordPress.org

Ready to get started?Download WordPress

Forums

Pagination Not Working on Custom Loop (1 post)

  1. ryanstrong
    Member
    Posted 2 years ago #

    I've searched and searched and have not solved my problem. I seems like there are solutions but they are not working for my particular code.

    What I would like to do is to have two loops - one that calls up the most recent post and acts as the main "featured post". Second is simply the second most recent post that is styled differently - then below the second or "sub post" I would like pagination.

    Problem is... the pagination does not work. The numbers show up, but when I click on them nothing happens. Would appreciate any help!

    Here is the code...

    <div id="featuredpost">
    
      <?php $my_query = new WP_Query('posts_per_page=1&cat=4');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID; ?>
    
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
    			<span class="subposttitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></span><br>
    			<small>Posted in <?php the_category(', ') ?> on <?php the_time('l, F jS') ?>.</small>
    <br><br>
    
    			<div class="entry">
    				<?php the_content(); ?>
    			</div>
    
    		</div>
    <br>
    	<hr>
    <br><br>
    <?php endwhile; ?>
    
    </div>
    
    <div id="subposts">
    
      <?php $my_query = new WP_Query('posts_per_page=1&offset=1&cat=4');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID;
    
       ?>
    
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
    			<span class="subposttitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></span><br>
    			<small>Posted in <?php the_category(', ') ?> on <?php the_time('l, F jS') ?>.</small>
    <br><br>
    
    			<div class="entry">
    				<?php the_content(); ?>
    			</div>
    
    		</div>
    <br>
    	<hr>
    <br>
    
    	<?php endwhile; ?>
    
    <center>
    	<?php wp_pagenavi() ?>
    </center>
    
    </div>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.