WordPress:Template Tags/next post

来自站长百科
跳转至: 导航、​ 搜索

This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.


描述[ ]

这个标签用在一篇单一的文章/permalink网页上,列出了在当前文章之后发表的下一篇文章。这个标签可以与previous_post()标签一起运行。必须在The Loop内使用这个标签。

对于索引,类别,和归档模板,请使用posts_nav_link()标签。

取代[ ]

next_post_link()

用法[ ]

%%% <?php next_post('format', 'next', 'title', 'in_same_cat',limitnext, excluded_category); ?> %%%

例子[ ]

默认用法[ ]

默认情况下,显示文本"下一篇文章:"与文章标题一起作为链接。


<?php next_post(); ?>

将文本用作链接,不带有文章标题[ ]

显示规定的文本作为链接,不包括文章标题。如果过长的文章标题破坏了你的布局,你可能想试试这个。" 下一个 » "是这个例子中规定的文本;你可以放入你想要的任何文本。

%%% <?php next_post('%','Next »', 'no'); ?> %%%

使用特定的文本[ ]

显示上一篇文章和下一篇文章的链接,将文本放在文本标题的前面,文章标题不作为链接。

Previous: Previous Post Title    |    Next: 下一篇文章标题
<p><?php previous_post('%', 'Previous:', 'no'); ?> 
| <?php next_post('%', 'Next:', 'no'); ?></p>

使用箭头符号而不是文本[ ]

在前一篇文章链接的开头和后一篇文章链接的结尾,显示文本,像箭头符号,这样看起来像:

<?php previous_post('&laquo; &laquo; %', '', 'yes'); ?>
| <?php next_post('% &raquo; &raquo; ', '', 'yes'); ?>

参数[ ]

format
(string) 链接的格式字符串。字符串中的'%'会被链接所取代,这样'Go to %'会产生"Go to <a href=..." 默认为'%'
next
(string) 需要显示的链接文本。默认为'下一篇文章: '
title
(string) 显示标题是否应该被用在链接文本。如果设置为'yes',立马追随下一个 (以上的)。选项有:
  • 'yes' (Default)
  • 'no'
in_same_cat
(string) 显示下一篇文章链接是否必须与当前的文章链接在同一个类别中。参数在WordPress1.5.1.3版本及更高的版本中能够运行。如果文章列在几个类别中,会在母类别内显示文章,而不是在子类别内。选项是:
  • 'yes'
  • 'no' (Default)
limitnext
(integer) 将下一篇文章链接设置到参数数值(当前文章ID加上limitnext)。默认为1。推荐默认设置。
excluded_category
(integer -or- string) 下一篇文章不应该列出的类别ID数字。用''分开多个类别;'1和 5 和15'。没有默认设置。参数在WordPress1.5.2版本以及更高的版本上能够运行。

相关的[ ]

也看看previous_post()

the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta,