WordPress: Template Tags/previous post link:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == Description == Used on single post permalink pages, this template tag displays a link to the previous post which exists in chronological order from th...)
 
无编辑摘要
第1行: 第1行:
== Description ==
== Description ==
== 描述 ==


Used on single post [[WordPress:Glossary#Permalink|permalink]] pages, this template tag displays a link to the previous post which exists in chronological order from the current post.
Used on single post [[WordPress:Glossary#Permalink|permalink]] pages, this template tag displays a link to the previous post which exists in chronological order from the current post.
这个模板标签用在一篇单一的文章[[WordPress:Glossary#Permalink|permalink]]网页上,显示一个链接,链接到前一篇文章,前一篇文章指的是在发表时间在当前文章之前。


This tag must be used in [[WordPress:The Loop]].
This tag must be used in [[WordPress:The Loop]].
必须在[[WordPress:The Loop|The Loop]]内使用这个标签。
== Usage ==
== 用法 ==


== Usage ==
%%% <?php previous_post_link('format', 'link', in_same_cat,
                        'excluded_categories'); ?> %%%


%%% <?php previous_post_link('format', 'link', in_same_cat,  
%%% <?php previous_post_link('format', 'link', in_same_cat,  
第11行: 第20行:


== Examples  ==
== Examples  ==
==例子 ==


===Default Usage===
===Default Usage===
===默认用法===
Displays link with left angular quote (&laquo;) followed by the post title of the previous post (chronological post date order). By default, this tag works like [[WordPress:Template_Tags/previous_post|previous_post()]].
Displays link with left angular quote (&laquo;) followed by the post title of the previous post (chronological post date order). By default, this tag works like [[WordPress:Template_Tags/previous_post|previous_post()]].
用左angular quote (&laquo;),紧跟着前篇文章的文章标题(按文章日期的时间顺序排列的前一篇文章),显示链接。默认情况下,这个标签像[[WordPress:Template_Tags/previous_post|previous_post()]]一样运行。


<div style="border:1px solid blue; width:50%; padding:10px">[[WordPress:#Examples|&laquo; Previous Post Title]]</div>
<div style="border:1px solid blue; width:50%; padding:10px">[[WordPress:#Examples|&laquo; Previous Post Title]]</div>
   
 
  <div style="border:1px solid blue; width:50%; padding:10px">[[WordPress:#Examples|&laquo; 前一篇文章标题]]</div>
<pre><?php previous_post_link(); ?></pre>
<pre><?php previous_post_link(); ?></pre>


===Bold Post Title As Link===
===Bold Post Title As Link===
===粗体的文章标题作为链接===
Displays link with previous chronological post's title wrapped in 'strong' tags (typically sets text to bold).
Displays link with previous chronological post's title wrapped in 'strong' tags (typically sets text to bold).
显示链接,将时间上较前的文章标题包裹在'strong'标签中(通常将文本设置为粗体的)。


<div style="border:1px solid blue; width:50%; padding:10px">[[WordPress:#Examples|'''Previous Post Title''']]</div>
<div style="border:1px solid blue; width:50%; padding:10px">[[WordPress:#Examples|'''Previous Post Title''']]</div>
%%% <?php previous_post_link('<strong>%link</strong>'); ?> %%%
<div style="border:1px solid blue; width:50%; padding:10px">[[WordPress:#Examples|'''前一篇文章标题''']]</div>


%%% <?php previous_post_link('<strong>%link</strong>'); ?> %%%
%%% <?php previous_post_link('<strong>%link</strong>'); ?> %%%


===Text As Link, Without Post Title, Within Same Category===
===Text As Link, Without Post Title, Within Same Category===
===文本作为链接,没有文章标题,没有相同的类别===
Displays custom text as link to the previous post within the same category as the current post. Post title is not included here. "Previous in category" is the custom text, which can be changed to fit your requirements.
Displays custom text as link to the previous post within the same category as the current post. Post title is not included here. "Previous in category" is the custom text, which can be changed to fit your requirements.
显示自定义的文本作为链接,链接到与当前文章同类别的前一篇文章。不包含文章标题。"类别中的前一篇"是自定义文本,可以根据的你的需要更改。


<div style="border:1px solid blue; width:50%; padding:10px">[[WordPress:#Examples|Previous in category]]</div>
<div style="border:1px solid blue; width:50%; padding:10px">[[WordPress:#Examples|Previous in category]]</div>
%%% <?php previous_post_link('%link', 'Previous in category', TRUE); ?> %%%
<div style="border:1px solid blue; width:50%; padding:10px">[[WordPress:#Examples|类别中的前一篇]]</div>


%%% <?php previous_post_link('%link', 'Previous in category', TRUE); ?> %%%
%%% <?php previous_post_link('%link', 'Previous in category', TRUE); ?> %%%


===Within Same Category, Excluding One===
===Within Same Category, Excluding One===
===在同一个类别中,一篇除外===
Displays link to previous post in the same category, as long as it is not in category 13 (the category ID #). You can change the number to any category you wish to exclude. Exclude multiple categories by using "<tt> and </tt>" as a delimiter.
Displays link to previous post in the same category, as long as it is not in category 13 (the category ID #). You can change the number to any category you wish to exclude. Exclude multiple categories by using "<tt> and </tt>" as a delimiter.
显示链接,链接到同一个类别中的前一篇文章,只要这篇文章不属于类别13(类别ID#)。你可以将数字改为任何你想要排除的类别。使用"<tt> and </tt>"作为分隔符可以删除多个类别。


<div style="border:1px solid blue; width:50%; padding:10px">[[WordPress:#Examples|Previous in category]]</div>
<div style="border:1px solid blue; width:50%; padding:10px">[[WordPress:#Examples|Previous in category]]</div>


%%% <?php previous_post_link('%link', 'Previous in category', TRUE, '13'); ?> %%%
%%% <?php previous_post_link('%link', 'Previous in category', TRUE, '13'); ?> %%%
<div style="border:1px solid blue; width:50%; padding:10px">[[WordPress:#Examples|类别中的前一篇]]</div>
%%% <?php previous_post_link('%link', '类别中的前一篇', TRUE, '13'); ?> %%%


== Parameters ==
== Parameters ==
== 参数 ==


; format : (''string'') Format string for the link. This is where to control what comes before and after the link. <tt>'%link'</tt> in string will be replaced with whatever is declared as <tt>'link'</tt> (see next parameter). <tt>'Go to %link'</tt> will generate "Go to <a href=..." Put HTML tags here to style the final results. Defaults to <tt>'&amp;laquo; %link'</tt>.
; format : (''string'') Format string for the link. This is where to control what comes before and after the link. <tt>'%link'</tt> in string will be replaced with whatever is declared as <tt>'link'</tt> (see next parameter). <tt>'Go to %link'</tt> will generate "Go to <a href=..." Put HTML tags here to style the final results. Defaults to <tt>'&amp;laquo; %link'</tt>.
;格式:(''string'')链接的格式字符串。这个字符串控制了链接前后可以出现什么。字符串中的<tt>'%link'</tt>会被称为<tt>'链接'</tt>的任何内容所取代(请看看下一个链接)。<tt>'进入%链接'</tt>会产生"进入 <a href=..."在这儿放上HTML标签,设计最后的结果。默认为<tt>'&amp;laquo; %link'</tt>。
; link : (''string'') Link text to display. Defaults to previous post's title (<tt>'%title'</tt>).
; link : (''string'') Link text to display. Defaults to previous post's title (<tt>'%title'</tt>).
;链接:(''string'')显示的链接文本。默认为前一篇文章的标题(<tt>'%标题'</tt>)。
; in_same_cat : (''boolean'') Indicates whether previous post must be within the same category as the current post. If set to <tt>TRUE</tt>, only posts from the current category will be displayed. Options are:
; in_same_cat : (''boolean'') Indicates whether previous post must be within the same category as the current post. If set to <tt>TRUE</tt>, only posts from the current category will be displayed. Options are:
; in_same_cat : (''boolean'')暗示前一篇文章是否必须与当前的文章在同一个类别中。如果设置为<tt>正确的</tt>,只有来自当前类别的文章才会得到显示。选项是:
:* <tt>TRUE</tt>  
:* <tt>TRUE</tt>  
:* <tt>FALSE</tt> (Default)
:* <tt>FALSE</tt> (Default)
:* <tt>正确的</tt>
:* <tt>错误的</tt> (默认)
; excluded_categories : (''string'') Numeric category ID(s) from which the previous post should not be listed. Separate multiple categories with <tt>and</tt>; example: <tt>'1 and 5 and 15'</tt>. There is no default.
; excluded_categories : (''string'') Numeric category ID(s) from which the previous post should not be listed. Separate multiple categories with <tt>and</tt>; example: <tt>'1 and 5 and 15'</tt>. There is no default.
; excluded_categories : (''string'')前一篇文章应该列出的类别ID。用<tt>和</tt>分开多个类别;例如:<tt>'1 和 5 和 15'</tt>。没有默认设置。


== Related ==
== Related ==
== 相关的==
See also [[WordPress:Template Tags/next_post_link|next_post_link()]].
See also [[WordPress:Template Tags/next_post_link|next_post_link()]].
也看看[[WordPress:Template Tags/next_post_link|next_post_link()]]。


{{Tag Post Tags}}
{{Tag Post Tags}}


{{PHP Function Tag Footer}}
{{PHP Function Tag Footer}}
{{标签文章标签}}
{{PHP函数标签页底文字}}

2008年7月9日 (三) 17:33的版本

Description

描述

Used on single post permalink pages, this template tag displays a link to the previous post which exists in chronological order from the current post.

这个模板标签用在一篇单一的文章permalink网页上,显示一个链接,链接到前一篇文章,前一篇文章指的是在发表时间在当前文章之前。

This tag must be used in WordPress:The Loop. 必须在The Loop内使用这个标签。

Usage

用法

%%% <?php previous_post_link('format', 'link', in_same_cat,

                        'excluded_categories'); ?> %%%

%%% <?php previous_post_link('format', 'link', in_same_cat,

                        'excluded_categories'); ?> %%%

Examples

例子

Default Usage

默认用法

Displays link with left angular quote («) followed by the post title of the previous post (chronological post date order). By default, this tag works like previous_post().

用左angular quote («),紧跟着前篇文章的文章标题(按文章日期的时间顺序排列的前一篇文章),显示链接。默认情况下,这个标签像previous_post()一样运行。

[[WordPress:#Examples|« Previous Post Title]]
[[WordPress:#Examples|« 前一篇文章标题]]
<?php previous_post_link(); ?>

Bold Post Title As Link

粗体的文章标题作为链接

Displays link with previous chronological post's title wrapped in 'strong' tags (typically sets text to bold).

显示链接,将时间上较前的文章标题包裹在'strong'标签中(通常将文本设置为粗体的)。

[[WordPress:#Examples|Previous Post Title]]

%%% <?php previous_post_link('%link'); ?> %%%


[[WordPress:#Examples|前一篇文章标题]]

%%% <?php previous_post_link('%link'); ?> %%%

Text As Link, Without Post Title, Within Same Category

文本作为链接,没有文章标题,没有相同的类别

Displays custom text as link to the previous post within the same category as the current post. Post title is not included here. "Previous in category" is the custom text, which can be changed to fit your requirements.

显示自定义的文本作为链接,链接到与当前文章同类别的前一篇文章。不包含文章标题。"类别中的前一篇"是自定义文本,可以根据的你的需要更改。

[[WordPress:#Examples|Previous in category]]

%%% <?php previous_post_link('%link', 'Previous in category', TRUE); ?> %%%

[[WordPress:#Examples|类别中的前一篇]]

%%% <?php previous_post_link('%link', 'Previous in category', TRUE); ?> %%%

Within Same Category, Excluding One

在同一个类别中,一篇除外

Displays link to previous post in the same category, as long as it is not in category 13 (the category ID #). You can change the number to any category you wish to exclude. Exclude multiple categories by using " and " as a delimiter.

显示链接,链接到同一个类别中的前一篇文章,只要这篇文章不属于类别13(类别ID#)。你可以将数字改为任何你想要排除的类别。使用" and "作为分隔符可以删除多个类别。

[[WordPress:#Examples|Previous in category]]

%%% <?php previous_post_link('%link', 'Previous in category', TRUE, '13'); ?> %%%


[[WordPress:#Examples|类别中的前一篇]]

%%% <?php previous_post_link('%link', '类别中的前一篇', TRUE, '13'); ?> %%%

Parameters

参数

format
(string) Format string for the link. This is where to control what comes before and after the link. '%link' in string will be replaced with whatever is declared as 'link' (see next parameter). 'Go to %link' will generate "Go to <a href=..." Put HTML tags here to style the final results. Defaults to '&laquo; %link'.

;格式:(string)链接的格式字符串。这个字符串控制了链接前后可以出现什么。字符串中的'%link'会被称为'链接'的任何内容所取代(请看看下一个链接)。'进入%链接'会产生"进入 <a href=..."在这儿放上HTML标签,设计最后的结果。默认为'&laquo; %link'

link
(string) Link text to display. Defaults to previous post's title ('%title').

;链接:(string)显示的链接文本。默认为前一篇文章的标题('%标题')。

in_same_cat
(boolean) Indicates whether previous post must be within the same category as the current post. If set to TRUE, only posts from the current category will be displayed. Options are:
in_same_cat
(boolean)暗示前一篇文章是否必须与当前的文章在同一个类别中。如果设置为正确的,只有来自当前类别的文章才会得到显示。选项是:
  • TRUE
  • FALSE (Default)
  • 正确的
  • 错误的 (默认)


excluded_categories
(string) Numeric category ID(s) from which the previous post should not be listed. Separate multiple categories with and; example: '1 and 5 and 15'. There is no default.
excluded_categories
(string)前一篇文章应该列出的类别ID。用分开多个类别;例如:'1 和 5 和 15'。没有默认设置。

Related

相关的

See also next_post_link().

也看看next_post_link()

模板: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,