From a single post, how do I change the links at the bottom of the post to display links to the previous & next post in the same category?
It currently displays links to the previous and next post of any category.
Thanks in advance,
- LL
From a single post, how do I change the links at the bottom of the post to display links to the previous & next post in the same category?
It currently displays links to the previous and next post of any category.
Thanks in advance,
- LL
Hi,
Open single.php and find this code
<div class='post_nav'>
<div class='previous_post_link_align'>
<?php previous_post_link('<span class="previous_post_link">← %link </span>'); ?>
</div>
<div class='next_post_link_align'>
<?php next_post_link('<span class="next_post_link">%link →</span>'); ?>
</div>
</div> <!-- end navigation -->
Replace it with this code
<div class='post_nav'>
<div class='previous_post_link_align'>
<?php previous_post_link('<span class="previous_post_link">← %link </span>', '%title', TRUE); ?>
</div>
<div class='next_post_link_align'>
<?php next_post_link('<span class="next_post_link">%link →</span>', '%title', TRUE); ?>
</div>
</div> <!-- end navigation -->
Regards,
Ismael
Hi. Im having the same issue with my portfolio next & previous buttons. I used the code above but its still showing up categories from other.
Hi Zedduo,
As long as it has the true in the function it should only be able to pull from the same category. See the codex entry for previous_post_link here: http://codex.wordpress.org/Function_Reference/previous_post_link#Text_As_Link.2C_Without_Post_Title.2C_Within_Same_Category
Try refreshing your page a few times to make sure you aren't looking at a cached version where your code change hasn't been applied.
Regards,
Devin
You must log in to post.