categories - Show PreviousNext Posts navigation only inside the same category

Is it possible to force previousnext navigation to browse through the posts (back and forth) that are only inside the s

Is it possible to force previous/next navigation to browse through the posts (back and forth) that are only inside the same category (and to exclude other categories)?

Is it possible to force previous/next navigation to browse through the posts (back and forth) that are only inside the same category (and to exclude other categories)?

Share Improve this question edited Apr 8, 2012 at 22:41 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Apr 8, 2012 at 17:09 BloglimitsBloglimits 411 silver badge3 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 5

The functions accept an $in_same_cat argument, the default value of which is false. Just set that to true.

previous_post_link($format, $link, true);
next_post_link($format, $link, true);

You can use the following code in single.php loop to display nex/pre links in same category

<?php


get_template_part( 'content', get_post_format() );

 // Previous/next post navigation.
previous_post_link('%link', 'Before', true );
next_post_link( '%link', 'Next', true );

?>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745271837a4619795.html

相关推荐

  • categories - Show PreviousNext Posts navigation only inside the same category

    Is it possible to force previousnext navigation to browse through the posts (back and forth) that are only inside the s

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信