当您单击上一个/下一个按钮时,显示同一类别的帖子 [英] show post from the same category when you click previous/next button wordpress

查看:95
本文介绍了当您单击上一个/下一个按钮时,显示同一类别的帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题。不幸的是,当我单击同一类别的上一个/下一个按钮时,我收到的是年代学上的上一个/下一个帖子,而不是同一类别的上一个/下一个帖子。

I have the below issue. When I click to the previous/next button of the same category unfortunately i receive the previous/next post hronologically instead of the previous/next post of the same category.

这里是代码:

< div id="previous_post">
< ?php previous_post_link( '%link', __( '<span class="prev"><< Preivous Post</span>', 'esquire' ) ); ? > 
< /div>

< div id="next_post">   < ?php next_post_link( '%link', __( '<span class="next">Next Post >></span>',  'esquire' ) ); ? >

< /div>

我已尝试通过本文解决问题 http://codex.wordpress.org/Function_Reference/next_post_link
但我做错了。

I've tried to fix my problem with this article http://codex.wordpress.org/Function_Reference/next_post_link but something i am doing wrong.

有什么建议吗?

推荐答案

例如

 previous_post_link( '%link', __( '<span class="prev"><< Preivous Post</span>', TRUE, 'esquire' ) );

我不想每次都指定每个类别。我希望这是自动完成的。例如,当它显示类别计算机中的帖子并且您打开以阅读第一篇文章时,当您单击到下一篇文章时,则必须看到同一类别的下一篇文章,而不是通常的下一篇文章。如果类别是食物,那么下一个相同类别的帖子。

I don't want to specify every time each category. I want this to be done automatically. For example, when it shows the posts from category machine and you open to read the first post, when you click to next post, then you must see next post of the same category not the next post in general. If the category is food, then the next post of the same category.

我很清楚,或者我对您还感到困惑?

I was clear or I confused you more?

这篇关于当您单击上一个/下一个按钮时,显示同一类别的帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆