抄本本身不同意,所以我被难住了。
在…上single.php
我正在尝试使用next_post_link()
使用自定义链接文本,在与当前帖子相同的类别内显示指向下一篇帖子的链接。
这个Codex article on next_post_link()
表示参数为$format、$link、$in\\u same\\u term、$excluded\\u terms和$taxonomy。我的场景的具体示例是
<?php next_post_link( \'%link\', \'Next post in category\', TRUE ); ?>
但当我使用那个精确的代码时,根本没有输出任何链接。文章的其余部分完全呈现,只是完全缺少下一篇文章链接HTML。如果我只取下“TRUE”,它会输出一个几乎符合需要的链接:
<?php next_post_link( \'%link\', \'Next post in category\' ); ?>
但它链接到任何类别的下一篇文章,我需要将其限制到当前类别。这个Codex article on Next and Previous Links 与文章的具体内容相矛盾next_post_link()
. 它说参数是$format、$text和$title。这意味着您不能将链接限制为当前类别内的帖子。自Code Reference on next_post_link()
匹配上的Codexnext_post_link()
这似乎是最准确的。