Support » Themes and Templates » Single.php Next Post/Previous Post links not displaying

  • When viewed as single posts, my blog entries are not displaying the “Next Post” and “Previous Post” links at the end of my articles.

    Here’s the entire code for my theme’s single.php:

    http://pastebin.com/qEePdu6d

    The endwhile and endif loop is currently in its original place here:

    <?php } } ?>
                    <?php the_content(); ?>
            <div class="clear"></div>
            <?php endwhile; ?>
            <?php endif; ?>
    
            <?php wp_link_pages('before=<div id="post-page-navigation">&after=</div>'); ?>
    
           <?php if ($options['disable_single_pagination'] != true) { ?>
                    <div id="single-nav" class="clearfix">
                            <div id="single-nav-left"><?php previous_post_link('%link', 'Previous Post', TRUE); ?></div>
                    <div id="single-nav-right"><?php next_post_link('%link', 'Next Post', TRUE); ?></div>
            </div>
            <!-- END single-nav -->
                    <?php } ?>

    I moved it according to the theme creator’s fix below and got an error message, so I ended up changed it back to its original location like it appears above.

    <?php } } ?>
                    <?php the_content(); ?>
            <div class="clear"></div>
    
            <?php wp_link_pages('before=<div id="post-page-navigation">&after=</div>'); ?>
    
           <?php if ($options['disable_single_pagination'] != true) { ?>
                    <div id="single-nav" class="clearfix">
                            <div id="single-nav-left"><?php previous_post_link('%link', 'Previous Post', TRUE); ?></div>
                    <div id="single-nav-right"><?php next_post_link('%link', 'Next Post', TRUE); ?></div>
            </div>
            <!-- END single-nav -->
            <?php endwhile; ?>
            <?php endif; ?>
                    <?php } ?>

    The theme creator is currently not answering questions in his own help forum, so I’m trying my luck here. My url is http://team1eighty.com for reference if needed.

    Some other info that may be useful:

    If I take out my current posts and restore test posts from the trash, the Next Post/Previous Post links appear.

    I changed the date of the ‘Welcome to my blog’ post. It’s original publish date would have made it the second chronological post, but I wanted it to appear as the first and earliest post, so I changed the date on it. I restored the original publish date and that didn’t help.

    I even tried publishing new posts for my articles altogether and trashing the originals. The Next Post/Previous Post links still don’t behave. I’ve also deactivated the following comment related plugins: Commentluv, Twitterlink Comments, and Subscribe to comments reloaded. No luck.

    Thanks for any help you can offer.

Viewing 10 replies - 1 through 10 (of 10 total)
  • When you moved it to the way that the theme creator ask you to, what error message did you get. Maybe troubleshooting that error message may help fix the issue.

    Hi parkerj,

    This is the error message:

    Parse error: syntax error, unexpected T_ENDWHILE in /home/lydia1/public_html/team1eighty.com/wp-content/themes/minimal-xpert/single.php on line 33

    Instead of moving both endwhile and endif loops, just move the endif and see what happens.

    I moved endif before each of these lines:

    <div id=”single-nav” class=”clearfix”>
    <div id=”single-nav-left”><?php previous_post_link(‘%link’, ‘Previous Post’, TRUE); ?></div>
    <div id=”single-nav-right”><?php next_post_link(‘%link’, ‘Next Post’, TRUE); ?></div>

    and got the same error message for each time. The line number of the error just changed.

    It should look like this:

    <?php } } ?>
    		<?php the_content(); ?>
            <div class="clear"></div>
    
            <?php wp_link_pages('before=<div id="post-page-navigation">&after=</div>'); ?>
    
           <?php if ($options['disable_single_pagination'] != true) { ?>
    		<div id="single-nav" class="clearfix">
    			<div id="single-nav-left"><?php previous_post_link('%link', 'Last Post', TRUE); ?></div>
    		<div id="single-nav-right"><?php next_post_link('%link', 'Next Post', TRUE); ?></div>
            </div>
            <!-- END single-nav -->
    		<?php } ?>
    
            <div class="post-entry-bottom">
            <?php the_tags('<div class="post-tags">',' ','</div>'); ?>
            <!-- END post-category -->
            </div>
            <!-- END post-entry-bottom -->
    
            </div>
            <!-- END post-entry -->
    	<?php endwhile; ?>
    		<?php endif; ?>

    OK. Just tried each of these:

    <?php if ($options['disable_single_pagination'] != true) { ?>
    		<div id="single-nav" class="clearfix">
    			<div id="single-nav-left"><?php previous_post_link('%link', 'Previous Post', TRUE); ?></div>
    		<div id="single-nav-right"><?php next_post_link('%link', 'Next Post', TRUE); ?></div>
            </div>
            <!-- END single-nav -->
    	<?php endif; ?>
    <?php if ($options['disable_single_pagination'] != true) { ?>
    		<div id="single-nav" class="clearfix">
    			<div id="single-nav-left"><?php previous_post_link('%link', 'Previous Post', TRUE); ?></div>
    		<div id="single-nav-right"><?php next_post_link('%link', 'Next Post', TRUE); ?></div>
            </div>
    	<?php endif; ?>
            <!-- END single-nav -->
    		<?php } ?>
    <?php if ($options['disable_single_pagination'] != true) { ?>
    		<div id="single-nav" class="clearfix">
    			<div id="single-nav-left"><?php previous_post_link('%link', 'Previous Post', TRUE); ?></div>
    		<div id="single-nav-right"><?php next_post_link('%link', 'Next Post', TRUE); ?></div>
    	<?php endif; ?>
            </div>
            <!-- END single-nav -->
    		<?php } ?>

    Getting same error 🙁

    Ok. I’ll try and report back shortly.

    The good news is I’m not getting error messages anymore. The not so good news: Next Post/Previous Post links still aren’t displaying.

    From what you posted the first time, that code looked differently from the single.php file I am looking at. If you haven’t done any modifications to the file, I would download the theme again, and upload the single.php over the current one to see if that fixes the issue. If that doesn’t fix it, if you have a plugin that manipulates the footer of your posts, try disabling those to see if they are the culprit.

    I’ll try that and share the outcome. Thanks, parkerj.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Single.php Next Post/Previous Post links not displaying’ is closed to new replies.