• I want the previous/next links to only navigate to posts within the same category. At the moment it it scrolls between all the posts.

    From reading the codex I think I need to edit template-tags.php and insert TRUE somewhere into this code:

    <?php previous_post_link( '<div class="nav-previous">%link</div>', '<span class="meta-nav">' . _x( '&larr;', 
    
    'Previous post link', 'sixteen' ) . '</span> %title',); ?>
    		<?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . 
    
    _x( '&rarr;', 'Next post link', 'sixteen' ) . '</span>', ); ?>
    	<?php elseif ( $wp_query->max_num_pages > 1 && ( is_home() || is_archive() || is_search() ) ) : // 
    
    navigation links for home, archive, and search pages ?>

    Your help will be very much appreciated.

The topic ‘Previous/Next link in Category’ is closed to new replies.