WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Working on a custom post template, using next_post_link and previous_post_link.

And they do -- EXCEPT on the most recent post: where next and previous both point to previous. Which is...confusing.

Not trying to keep it in the same category or anything, though, within the post type -- which should be happening by default I think.

Anybody seen anything like this?

Full template file here:

* Single Posts Template

<?php get_header() ?>

<div id="container">

<div id="portfolio-content">

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

$custom = get_post_custom($post->ID);
$display_slides = $custom["slides"][0];

<article id="post-<?php the_ID() ?>" <?php post_class() ?> >

<div class="slider full">
<?php echo ( do_shortcode( get_post_meta( $post->ID , 'slides' , true ) ) ); ?>

<div class="entry-title">
<h1><?php the_title(); ?></h1>
</div><!-- .entry-title -->

<div class="entry-content">
<?php the_content(); ?> 
</div><!-- .entry-content -->

<div class="client">
<?php the_terms( $post->ID, 'client', 'Client: ' ); ?>


<div id="post-navigation" class="full">
<div class="nav-previous"><?php next_post_link( '%link', 'Previous Project' ); ?></div>
<div class="nav-next"><?php previous_post_link( '%link', 'Next Project' ); ?></div>
</div><!-- #post-navigation -->

<?php endwhile; else: ?>
<?php endif; ?>

</div><!-- #content -->

</div><!-- #container -->

<?php get_footer() ?>
share|improve this question
Usually the unnecessary link is not present or not clickable, but what is the point of the question? "No, I personally haven't ever seen that." Now what? How does that help anyone? No offense... – s_ha_dum Sep 9 '13 at 21:58
Good point. I don't want the unnecessary link there, since having previous and next both point you to the same post is confusing to a high degree. I should have said: anybody seen anything like this -- and fixed it? – Martin Sep 10 '13 at 1:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.