WordPress:Template Tags/next post

来自站长百科
Fludlen讨论 | 贡献2008年7月10日 (四) 11:28的版本
跳转至: 导航、​ 搜索

模板:Deprecated


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.


Description

描述

Used on single post/permalink pages, this tag lists the next post in chronological order from the current post. It can work in conjuntion with the previous_post() tag. This tag must be used in WordPress:The Loop.

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

For the index, category, and archives templates, use the posts_nav_link() tag.

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

Replace With

取代

next_post_link(). next_post_link()

Usage

用法

%%% <?php next_post('format', 'next', 'title', 'in_same_cat',

               limitnext, excluded_category); ?> %%%

%%% <?php next_post('format', 'next', 'title', 'in_same_cat',

               limitnext, excluded_category); ?> %%%

Examples

例子

Default Usage

默认用法

By default, displays text "next post:" as link along with post title.

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

[[WordPress:#Examples|next post: Next Post Title]]
<?php next_post(); ?>
[[WordPress:#Examples|下一篇文章: 下一篇文章标题]]
<?php next_post(); ?>

Using Text As Link, Without Post Title

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

Displays specified text as link, without including the post title. If excessively long post titles break your layout, you may want to use this. "Next »" is the specified text in this example; you can put whatever you want.

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

[[WordPress:#Examples|Next »]]

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

[[WordPress:#Examples|下一个»]]

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

Using Specific Text

使用特定的文本

Displays previous and next post links in the format with the text before the post title not shown as a link.

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

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

Using Arrows Not Text

使用箭头符号而不是文本

To display text, like arrows («), at the beginning of the previous post link and at the end of the next post link so it looks like:

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

[[WordPress:#Examples|« « Previous Post Title]]    |    [[WordPress:#Examples|Next Post Title » » ]]
<?php previous_post('&laquo; &laquo; %', '', 'yes'); ?>
| <?php next_post('% &raquo; &raquo; ', '', 'yes'); ?>


[[WordPress:#Examples|« «上一篇文章标题]]    |    [[WordPress:#Examples|下一篇文章标题 » » ]]
<?php previous_post('&laquo; &laquo; %', '', 'yes'); ?>
| <?php next_post('% &raquo; &raquo; ', '', 'yes'); ?>


Parameters

参数

format
(string) Format string for the link. '%' in string will be replaced with the link, so 'Go to %' will generate "Go to <a href=..." Defaults to '%'.

;格式:(string)链接的格式字符串。字符串中的'%'会被链接所取代,这样'Go to %'会产生"Go to <a href=..." 默认为'%'


next
(string) Link text to display. Defaults to 'next post: '.
下一个:(string)需要显示的链接文本。默认为'下一篇文章: '


title
(string) Indicates whether title should be used as link text. If set to 'yes', immediately follows next (above). Options are:

;标题:(string)暗示标题是否应该被用在链接文本。如果设置为'是的',立马追随下一个 (以上的)。选项有:


  • 'yes' (Default)
  • 'no'
  • '是的' (默认)
  • '不是的'


in_same_cat
(string) Indicates whether the next post link must be in the same category/categories as current. Parameter works with versions of WordPress 1.5.1.3 and above. If post is listed in more than one category, it will show posts within the parent category, not the child category. Options are:
in_same_cat
(string)暗示下一篇文章链接是否必须与当前的文章链接在同一个类别中。参数在WordPress1.5.1.3版本及更高的版本中能够运行。如果文章列在几个类别中,会在母类别内显示文章,而不是在子类别内。选项是:


  • 'yes'
  • 'no' (Default)
  • '是的'
  • '不是的' (默认)


limitnext
(integer) Sets next post link on numeric value of parameter (current post ID plus limitnext). Defaults to 1. Default is recommended.
limitnext
(整数)将下一篇文章链接设置到参数数值(当前文章ID加上limitnext)。默认为1。推荐默认设置。


excluded_category
(integer -or- string) Numeric category ID(s) from which the next post should not be listed. Separate multiple categories with an 'and': '1 and 5 and 15'. There is no default. Parameter works with versions of WordPress 1.5.2 and above.
excluded_categories
(integer –或- string)下一篇文章不应该列出的类别ID数字。用''分开多个类别;'1和 5 和15'。没有默认设置。参数在WordPress1.5.2版本以及更高的版本上能够运行。

Related

相关的

See also previous_post().

也看看previous_post()

模板:Tag Post Tags

模板:PHP Function Tag Footer

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,