WordPress: Template Tags/wp get archives:修订间差异
(新页面: == Description == This function displays a date-based archives list in the same way as get_archives(). The only difference is that parameter argu...) |
无编辑摘要 |
||
第1行: | 第1行: | ||
== Description == | == Description == | ||
== 描述 == | |||
This function displays a date-based archives list in the same way as [[WordPress:Template_Tags/get_archives|get_archives()]]. The only difference is that parameter arguments are given to the function in query string format. This tag can be used anywhere within a template. | This function displays a date-based archives list in the same way as [[WordPress:Template_Tags/get_archives|get_archives()]]. The only difference is that parameter arguments are given to the function in query string format. This tag can be used anywhere within a template. | ||
这个函数显示了按日期保存的存档,与[[WordPress:Template_Tags/get_archives|得到_归档()]]排列的方式是相同的。唯一的不同点在于,参数自变量是以查询字符串的形式提交给函数的。必须在模板内的任何位置使用这个标签。 | |||
== Usage == | == Usage == | ||
%%% <?php wp_get_archives('arguments'); ?> %%% | %%% <?php wp_get_archives('arguments'); ?> %%% | ||
== 用法 == | |||
%%% <?php wp_得到_归档('参数'); ?> %%% | |||
== Examples == | == Examples == | ||
第16行: | 第24行: | ||
'after' => '', | 'after' => '', | ||
'show_post_count' => false); ?>%%% | 'show_post_count' => false); ?>%%% | ||
== 例子 == | |||
===默认用法=== | |||
%%% <?php $默认 = 数组( | |||
'类型' => '按月', | |||
'限制' => '', | |||
'形式' => 'html', | |||
'之前' => '', | |||
'之后' => '', | |||
'显示_文章_数目' => 错误的); ?>%%% | |||
By default, the usage shows: | By default, the usage shows: | ||
默认情况下,用法显示: | |||
* Monthly archives links displayed | * Monthly archives links displayed | ||
*按月归档,显示链接 | |||
* Displays all archives (not limited in number) | * Displays all archives (not limited in number) | ||
*显示所有的存档(不限制数目) | |||
* Displays archives in an <nowiki><li></nowiki> HTML list | * Displays archives in an <nowiki><li></nowiki> HTML list | ||
*以一个<nowiki><li></nowiki>HTML列表显示归档。 | |||
* Nothing displayed before or after each link | * Nothing displayed before or after each link | ||
*每个链接的前面或者后面不显示任何内容 | |||
* Does not display the count of the number of posts | * Does not display the count of the number of posts | ||
*不显示文章的数目 | |||
===Last Twelve Months=== | ===Last Twelve Months=== | ||
===最后十二个月=== | |||
Displays archive list by month, displaying only the last twelve. | Displays archive list by month, displaying only the last twelve. | ||
按月显示归档列表,只显示最后十二个月的归档。 | |||
%%%<?php wp_get_archives('type=monthly&limit=12'); ?>%%% | %%%<?php wp_get_archives('type=monthly&limit=12'); ?>%%% | ||
%%%<?php wp_得到_归档('类型=按月&限制=12'); ?>%%% | |||
===Last Fifteen Days=== | ===Last Fifteen Days=== | ||
===最后十五天=== | |||
Displays archive list by date, displaying only the last fifteen days. | Displays archive list by date, displaying only the last fifteen days. | ||
按天显示归档列表,只显示最后十五天的存档。 | |||
%%%<?php wp_get_archives('type=daily&limit=15'); ?>%%% | %%%<?php wp_get_archives('type=daily&limit=15'); ?>%%% | ||
%%%<?php wp_得到_归档('类型=每天&限制=15'); ?>%%% | |||
===Last Twenty Posts=== | ===Last Twenty Posts=== | ||
===最后二十篇文章=== | |||
Displays archive list of the last twenty most recent posts listed by post title. | Displays archive list of the last twenty most recent posts listed by post title. | ||
显示文章标题列出的最后二十篇最近的文章的归档列表。 | |||
%%%<?php wp_get_archives('type=postbypost&limit=20&format=custom'); ?>%%% | %%%<?php wp_get_archives('type=postbypost&limit=20&format=custom'); ?>%%% | ||
%%%<?php wp_得到_存档('类型=postbypost&limit=20&format=custom'); ?>%%% | |||
===Dropdown Box=== | ===Dropdown Box=== | ||
===下拉列表框=== | |||
Displays a dropdown box of Monthly archives, in select tags, with the post count displayed. | Displays a dropdown box of Monthly archives, in select tags, with the post count displayed. | ||
显示按月归档的一个下拉列表框,在选择标签中,显示了文章数目。 | |||
%%% | %%% | ||
<select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'> | <select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'> | ||
<option value=""><?php echo attribute_escape(__('Select Month')); ?></option> | <option value=""><?php echo attribute_escape(__('Select Month')); ?></option> | ||
<?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select> | <?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select> | ||
%%% | |||
%%% | |||
<选择 名称="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'> | |||
<option 参数值=""><?php echo attribute_escape(__('选择月份')); ?></选型> | |||
<?php wp_得到_存档('类型=按月&format=选项&显示_文章_数目=1'); ?> </选择> | |||
%%% | %%% | ||
== Parameters == | == Parameters == | ||
== 参数 == | |||
; type : (''string'') The type of archive list to display. Defaults to WordPress settings. Valid values: | ; type : (''string'') The type of archive list to display. Defaults to WordPress settings. Valid values: | ||
;类型 : (''string'')需要显示的存档列表的类型。默认为WordPress设置。有效的参数值: | |||
:* <tt>yearly</tt> | :* <tt>yearly</tt> | ||
:* <tt>monthly</tt> (Default) | :* <tt>monthly</tt> (Default) | ||
第58行: | 第126行: | ||
:* <tt>weekly</tt> | :* <tt>weekly</tt> | ||
:* <tt>postbypost</tt> | :* <tt>postbypost</tt> | ||
:* <tt>按年</tt> | |||
:* <tt>按月</tt> (默认) | |||
:* <tt>每天</tt> | |||
:* <tt>每周</tt> | |||
:* <tt>一篇文章接着一篇文章</tt> | |||
; limit : (''integer'') Number of archives to get. Default is no limit. | ; limit : (''integer'') Number of archives to get. Default is no limit. | ||
; 限制: (''整数'')得到的存档的数目。默认没有数目限制。 | |||
; format : (''string'') Format for the archive list. Valid values: | ; format : (''string'') Format for the archive list. Valid values: | ||
; 格式 : (''string'')归档列表的格式。有效的参数值: | |||
:* <tt>html</tt> - In HTML list (<li>) tags and '''before''' and '''after''' strings. This is the default. | :* <tt>html</tt> - In HTML list (<li>) tags and '''before''' and '''after''' strings. This is the default. | ||
:* <tt>html</tt> -在HTML列表(<li>)标签和'''之前''' 和'''之后'''字符串中。这是默认的。 | |||
:* <tt>option</tt> - In select (<select>) or dropdown option (<option>) tags. | :* <tt>option</tt> - In select (<select>) or dropdown option (<option>) tags. | ||
:* <tt>选项</tt> -在选择(<选择>)或者下拉列表选项(<选项>)标签中。 | |||
:* <tt>link</tt> - Within link (<link>) tags. | :* <tt>link</tt> - Within link (<link>) tags. | ||
:* <tt>链接</tt> -在链接(<链接>)标签中。 | |||
:* <tt>custom</tt> - Custom list using the '''before''' and '''after''' strings. | :* <tt>custom</tt> - Custom list using the '''before''' and '''after''' strings. | ||
:* <tt>自定义</tt> -使用'''之前''' 和 '''之后'''自定义列表。 | |||
; before : (''string'') Text to place before the link when using the <tt>html</tt> or <tt>custom</tt> for '''format''' option. There is no default. | ; before : (''string'') Text to place before the link when using the <tt>html</tt> or <tt>custom</tt> for '''format''' option. There is no default. | ||
; 之前 : (''string'')为'''格式'''选项使用<tt>html</tt>或者<tt>自定义</tt>时,放置在链接之前的文本。 | |||
; after : (''string'') Text to place after the link when using the <tt>html</tt> or <tt>custom</tt> for '''format''' option. There is no default. | ; after : (''string'') Text to place after the link when using the <tt>html</tt> or <tt>custom</tt> for '''format''' option. There is no default. | ||
;之后:(''string'') 为'''格式'''选项使用<tt>html</tt>或者<tt>自定义</tt>时,放置在链接之后的文本。没有默认设置。 | |||
; show_post_count : (''boolean'') Display number of posts in an archive (<tt>1</tt> - true) or do not (<tt>0</tt> - false). For use with all '''type''' except <tt>'postbypost'</tt>. Defaults to <tt>0</tt>. | ; show_post_count : (''boolean'') Display number of posts in an archive (<tt>1</tt> - true) or do not (<tt>0</tt> - false). For use with all '''type''' except <tt>'postbypost'</tt>. Defaults to <tt>0</tt>. | ||
;显示_文章_数目:(''boolean'')在一个归档(<tt>1</tt> - 真的)中,显示文章的数目,或者不显示文章数目(<tt>0</tt> - 错误的)。使用所有'''类型''',<tt>'一篇文章接着一篇文章'</tt>这种类型,除外。 | |||
== Related == | == Related == | ||
第73行: | 第176行: | ||
{{Query String Tag Footer}} | {{Query String Tag Footer}} | ||
== 相关的== | |||
{{标签 总标签}} | |||
{{查询 字符串 标签 页底文字}} |
2008年7月3日 (四) 11:22的版本
Description
描述
This function displays a date-based archives list in the same way as get_archives(). The only difference is that parameter arguments are given to the function in query string format. This tag can be used anywhere within a template.
这个函数显示了按日期保存的存档,与得到_归档()排列的方式是相同的。唯一的不同点在于,参数自变量是以查询字符串的形式提交给函数的。必须在模板内的任何位置使用这个标签。
Usage
%%% <?php wp_get_archives('arguments'); ?> %%%
用法
%%% <?php wp_得到_归档('参数'); ?> %%%
Examples
Default Usage
%%% <?php $defaults = array(
'type' => 'monthly', 'limit' => , 'format' => 'html', 'before' => , 'after' => , 'show_post_count' => false); ?>%%%
例子
默认用法
%%% <?php $默认 = 数组(
'类型' => '按月', '限制' => , '形式' => 'html', '之前' => , '之后' => , '显示_文章_数目' => 错误的); ?>%%%
By default, the usage shows: 默认情况下,用法显示:
- Monthly archives links displayed
- 按月归档,显示链接
- Displays all archives (not limited in number)
- 显示所有的存档(不限制数目)
- Displays archives in an <li> HTML list
- 以一个<li>HTML列表显示归档。
- Nothing displayed before or after each link
- 每个链接的前面或者后面不显示任何内容
- Does not display the count of the number of posts
- 不显示文章的数目
Last Twelve Months
最后十二个月
Displays archive list by month, displaying only the last twelve.
按月显示归档列表,只显示最后十二个月的归档。
%%%<?php wp_get_archives('type=monthly&limit=12'); ?>%%%
%%%<?php wp_得到_归档('类型=按月&限制=12'); ?>%%%
Last Fifteen Days
最后十五天
Displays archive list by date, displaying only the last fifteen days.
按天显示归档列表,只显示最后十五天的存档。
%%%<?php wp_get_archives('type=daily&limit=15'); ?>%%%
%%%<?php wp_得到_归档('类型=每天&限制=15'); ?>%%%
Last Twenty Posts
最后二十篇文章
Displays archive list of the last twenty most recent posts listed by post title.
显示文章标题列出的最后二十篇最近的文章的归档列表。
%%%<?php wp_get_archives('type=postbypost&limit=20&format=custom'); ?>%%%
%%%<?php wp_得到_存档('类型=postbypost&limit=20&format=custom'); ?>%%%
Dropdown Box
下拉列表框
Displays a dropdown box of Monthly archives, in select tags, with the post count displayed.
显示按月归档的一个下拉列表框,在选择标签中,显示了文章数目。
%%% <select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'>
<option value=""><?php echo attribute_escape(__('Select Month')); ?></option> <?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select>
%%%
%%% <选择 名称="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'>
<option 参数值=""><?php echo attribute_escape(__('选择月份')); ?></选型> <?php wp_得到_存档('类型=按月&format=选项&显示_文章_数目=1'); ?> </选择>
%%%
Parameters
参数
- type
- (string) The type of archive list to display. Defaults to WordPress settings. Valid values:
- 类型
- (string)需要显示的存档列表的类型。默认为WordPress设置。有效的参数值:
- yearly
- monthly (Default)
- daily
- weekly
- postbypost
- 按年
- 按月 (默认)
- 每天
- 每周
- 一篇文章接着一篇文章
- limit
- (integer) Number of archives to get. Default is no limit.
- 限制
- (整数)得到的存档的数目。默认没有数目限制。
- format
- (string) Format for the archive list. Valid values:
- 格式
- (string)归档列表的格式。有效的参数值:
- html - In HTML list (<li>) tags and before and after strings. This is the default.
- html -在HTML列表(<li>)标签和之前 和之后字符串中。这是默认的。
- option - In select (<select>) or dropdown option (<option>) tags.
- 选项 -在选择(<选择>)或者下拉列表选项(<选项>)标签中。
- link - Within link (<link>) tags.
- 链接 -在链接(<链接>)标签中。
- custom - Custom list using the before and after strings.
- 自定义 -使用之前 和 之后自定义列表。
- before
- (string) Text to place before the link when using the html or custom for format option. There is no default.
- 之前
- (string)为格式选项使用html或者自定义时,放置在链接之前的文本。
- after
- (string) Text to place after the link when using the html or custom for format option. There is no default.
;之后:(string) 为格式选项使用html或者自定义时,放置在链接之后的文本。没有默认设置。
- show_post_count
- (boolean) Display number of posts in an archive (1 - true) or do not (0 - false). For use with all type except 'postbypost'. Defaults to 0.
;显示_文章_数目:(boolean)在一个归档(1 - 真的)中,显示文章的数目,或者不显示文章数目(0 - 错误的)。使用所有类型,'一篇文章接着一篇文章'这种类型,除外。