WordPress.org

Support

Support » How-To and Troubleshooting » pagination in single-customposttype.php file

pagination in single-customposttype.php file

  • I have a custom post type called collection. Within my single-collection.php file I have

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                <h3><?php the_title();?></h3><br />
    
    			<?php the_content(); ?>
    
    		<?php endwhile; ?>
    
    <?php next_post_link(); ?>
    <?php previous_post_link(); ?>
    <?php endif; ?>

    The Next/Previous Links do show up and work. But my problem is that the links are ignoring all of my posts and only jumping from the first post to the last post and vice versa.

    I will try to explain to the best of my ability.

    I have 5 posts, I start on post 5, the “previous” link appears so I click it. It jumps to post 1 instead of going to post 4. On post 1 the “next” link appears. It jumps to post 5 instead of post 2.

    Does this make sense to anybody?

    I would appreciate any help or insight you could offer.

  • The topic ‘pagination in single-customposttype.php file’ is closed to new replies.