WordPress.org

Ready to get started?Download WordPress

Forums

posts of same category in next_posts_link NOT working (2 posts)

  1. zacklive
    Member
    Posted 3 years ago #

    I try to display Next/Previous link of posts in the same category, I follow the instruction of Template_Tags/next_post_link, but not working, I can't figure out why. Here is my code in single.php:

    <div class="navigation">
    			<span class="pre-post"><?php previous_post_link('&laquo; %link','%title', true) ?></span>
    			<span class="next-post"><?php next_post_link(' %link &raquo;','%title', true) ?></span>
    		</div><!-- End#div.navigation -->

    For more information, here is the whole code of the single.php:

    <?php get_header(); ?>
    
    <div id="content">
    
    	<?php if(have_posts()) : ?>
    		<?php while(have_posts()) : the_post(); ?>
    			<div class="post" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    				<div class="entry">
    					<?php the_content(); ?>
    					<?php link_pages(__('<p><strong>Pages:</strong> ','less_theme'), '</p>', 'number'); ?>
    				</div><!-- End#div.entry -->
    				<div class="comments-template">
    					<?php comments_template('', true); ?>
    				</div><!-- End#div.comments-template -->
    			</div><!-- End#div.post-ID -->
    		<div class="navigation">
    			<span class="pre-post"><?php previous_post_link('&laquo; %link','%title', true) ?></span>
    			<span class="next-post"><?php next_post_link(' %link &raquo;','%title', true) ?></span>
    		</div><!-- End#div.navigation -->
    		<?php endwhile; ?>
    	<?php else : ?>
    		<div class="post">
    			<h2><?php _e('Not Found','less_theme'); ?></h2>
    		</div><!-- End#div.post -->
    	<?php endif; ?>
    
    </div><!-- End#div.container -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
  2. zacklive
    Member
    Posted 3 years ago #

    Can anyone help?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.