WordPress: Template Tags/list cats:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: {{Deprecated}} == Description == Displays a list of Categories as links. When one of those links is clicked, all the posts in that Category will display ...)
 
无编辑摘要
第1行: 第1行:
{{Deprecated}}
{{Deprecated}}
== Description ==
== Description ==
{{取消的}}
== 描述 ==


Displays a list of [[WordPress:Glossary#Category|Categories]] as links.  When one of those links is clicked, all the posts in that Category will display in the appropriate [[WordPress:Category Templates|Category Template]] dicatated by the [[WordPress:Template_Hierarchy|Template Hierarchy rules]].  This tag works like the [[WordPress:Template_Tags/wp_list_cats|wp_list_cats]] tag, except that [[WordPress:Template_Tags/list_cats|list_cats]] uses a long query string of arguments while [[WordPress:Template_Tags/wp_list_cats|wp_list_cats]] uses text-based query arguments. WordPress 2.1 saw the introduction of a new and more inclusive template tag [[WordPress:Template_Tags/wp_list_categories|wp_list_categories]], intended to replace ''wp_list_cats'' and ''list_cats''.
Displays a list of [[WordPress:Glossary#Category|Categories]] as links.  When one of those links is clicked, all the posts in that Category will display in the appropriate [[WordPress:Category Templates|Category Template]] dicatated by the [[WordPress:Template_Hierarchy|Template Hierarchy rules]].  This tag works like the [[WordPress:Template_Tags/wp_list_cats|wp_list_cats]] tag, except that [[WordPress:Template_Tags/list_cats|list_cats]] uses a long query string of arguments while [[WordPress:Template_Tags/wp_list_cats|wp_list_cats]] uses text-based query arguments. WordPress 2.1 saw the introduction of a new and more inclusive template tag [[WordPress:Template_Tags/wp_list_categories|wp_list_categories]], intended to replace ''wp_list_cats'' and ''list_cats''.
显示一列 [[WordPress:Glossary#Category|类别]] 作为一列链接。 当点击任何链接的时候,属于那个类别中的所有文章会在适当的[[WordPress:Category Templates|类别模板]]中显示,类别模板是由[[WordPress:Template_Hierarchy|模板层级规则]]规定的。这个标签与[[WordPress:Template_Tags/list_cats|列表_cats()]]的运行方式基本相似,不同的是,[[WordPress:Template_Tags/list_cats|列表_cats()]]使用一个很长的论证查询字符串,然而[[WordPress:Template_Tags/list_cats|列表_cats()]]使用以文本为基础的查询论证。WordPress 2.1拥有一个新的而且更具有包含性的模板标签 [[WordPress:Template_Tags/wp_list_categories|wp_列表_类别]],试图取代 ''wp_list_cats'' and ''list_cats''。


== Replace With ==
== Replace With ==
== 取代 ==


[[WordPress:Template Tags/wp_list_categories | wp_list_categories()]].
[[WordPress:Template Tags/wp_list_categories | wp_list_categories()]].
[[WordPress:Template Tags/wp_list_categories | wp_列表_类别()]]。


== Usage ==
== Usage ==
== 用法 ==
%%% <?php list_cats(optionall, 'all', 'sort_column',
                'sort_order', 'file', list, optiondates,
                optioncount, hide_empty, use_desc_for_title,
                children, child_of, 'Categories', recurse,
                'feed', 'feed_img', 'exclude',
                hierarchical); ?> %%%


%%% <?php list_cats(optionall, 'all', 'sort_column',
%%% <?php list_cats(optionall, 'all', 'sort_column',
第18行: 第39行:


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


=== Default List ===
=== Default List ===
===默认列表 ===


Displays the list of Categories using default settings:
Displays the list of Categories using default settings:
使用默认设置,显示类别列表。


  <?php list_cats(); ?>
  <?php list_cats(); ?>
<?php list_cats(); ?>


=== Sorted by Category Name ===
=== Sorted by Category Name ===
=== 根据类别名分类===


Displays the list of Categories, with not all Categories linked, and sorted by Category name:  
Displays the list of Categories, with not all Categories linked, and sorted by Category name:  
  <?php list_cats(FALSE, ' ', 'name'); ?>
  <?php list_cats(FALSE, ' ', 'name'); ?>
显示类别列表,并没有链接到所有的类别,而且是根据类别名分类的:
<?php list_cats(FALSE, ' ', 'name'); ?>


=== Customized List with Excluded Categories ===
=== Customized List with Excluded Categories ===
=== 拥有已删除类别的自定义列表===


Sets the list to not list all the Categories (based upon further parameters), sorts by ID in ascending order and in an unordered list (<tt><nowiki><ul><li></nowiki></tt>) without dates or post counts, does not hide empty Categories, uses Category "description" for the title in the links, does not show the children of the parent Categories, and excludes Categories 1 and 33:
Sets the list to not list all the Categories (based upon further parameters), sorts by ID in ascending order and in an unordered list (<tt><nowiki><ul><li></nowiki></tt>) without dates or post counts, does not hide empty Categories, uses Category "description" for the title in the links, does not show the children of the parent Categories, and excludes Categories 1 and 33:
   
   
设置列表不显示所有的类别(以深一层的参数为基础),以升序根据ID分类而且在一个无序类别中(<tt><nowiki><ul><li></nowiki></tt>),没有文章发表的日期或者文章的数目,不隐藏内容为空的类别,使用"描述"作为链接的标题,不显示母类别的子类别,而且删除类别1和33:
<pre><?php list_cats(FALSE, '', 'ID',
<pre><?php list_cats(FALSE, '', 'ID',
                 'asc', '', TRUE, FALSE,  
                 'asc', '', TRUE, FALSE,  
第40行: 第78行:
                 '', '', '1,33',  
                 '', '', '1,33',  
                 TRUE); ?></pre>
                 TRUE); ?></pre>
<pre><?php list_cats(FALSE, '', 'ID',
                'asc', '', TRUE, FALSE,
                FALSE, FALSE, TRUE,
                FALSE, FALSE, '', FALSE,
                '', '', '1,33',
                TRUE); ?></pre>


== Notes on use ==  
== Notes on use ==  
== 使用注意事项==


When the 'list' parameter is set for an unordered list, the list_cats() tag automatically begins and ends with <tt>UL</tt> and each item listed as an <tt>LI</tt>.
When the 'list' parameter is set for an unordered list, the list_cats() tag automatically begins and ends with <tt>UL</tt> and each item listed as an <tt>LI</tt>.
当为一个无序的列表设置'列表'参数的时候,列表_cats()标签自动地以<tt>UL</tt>开启和关闭,而且每个类别列为一个<tt>LI</tt>。


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


; optionall : (''boolean'') Sets whether to display a link to all Categories.  Note: This feature no longer works in WordPress 1.5.x and 2.0 but is slated to be added back at Version 2.1.  Valid values:
; optionall : (''boolean'') Sets whether to display a link to all Categories.  Note: This feature no longer works in WordPress 1.5.x and 2.0 but is slated to be added back at Version 2.1.  Valid values:
; optionall : (''boolean'')设置是否显示一个练级连接扫所有的类别。注:WordPress1.5x和2.0版本中不再包含这个功能,但是2.1版本中又重新添加了这个功能。有效的参数值:
:* <tt>TRUE</tt> (Default)
:* <tt>TRUE</tt> (Default)
:* <tt>FALSE</tt>
:* <tt>FALSE</tt>
:* <tt>正确的</tt> (默认的)
:* <tt>错误的</tt>
; all : (''string'') If ''optionall'' is set to TRUE, this defines the text to be displayed for the link to all Categories.  Note: This feature no longer works in WordPress 1.5.x and 2.0 but is slated to be added back at Version 2.1. Defaults to <tt>'All'</tt>.
; all : (''string'') If ''optionall'' is set to TRUE, this defines the text to be displayed for the link to all Categories.  Note: This feature no longer works in WordPress 1.5.x and 2.0 but is slated to be added back at Version 2.1. Defaults to <tt>'All'</tt>.
;所有的 : (''string'')如果 ''optionall''设置为真的,这定义了文本显示链接连接到所有的类别。注:WordPress1.5x和2.0中不再运行这个功能,但是2.1版本中又重新添加了这个功能。默认<tt>'所有的'</tt>。
; sort_column : (''string'') Key to sort options by. Valid values:
; sort_column : (''string'') Key to sort options by. Valid values:
; sort_column : (''string'')选项分类的关键词。有效的参数值:
:* <tt>'ID'</tt> (Default)
:* <tt>'ID'</tt> (Default)
:* <tt>'name'</tt>
:* <tt>'name'</tt>
:* <tt>'ID'</tt> (默认的)
:* <tt>'名称'</tt>
; sort_order : (''string'') Sort order for options. Valid values:
; sort_order : (''string'') Sort order for options. Valid values:
; 分类_顺序 : (''string'')选项的分类顺序。有效的参数值:
:* <tt>'asc'</tt> (Default)
:* <tt>'asc'</tt> (Default)
:* <tt>'desc'</tt>
:* <tt>'desc'</tt>
:* <tt>'asc'</tt> (默认的)
:* <tt>'desc'</tt>
; file : (''string'') The php file a Category link is to be displayed on. Defaults to <tt>'index.php'</tt>.
; file : (''string'') The php file a Category link is to be displayed on. Defaults to <tt>'index.php'</tt>.
;文件 : (''string'')显示类别链接的php文件。默认<tt>'index.php'</tt>。
; list : (''boolean'') Sets whether the Categories are enclosed in an unordered list (<nowiki><ul><li></nowiki>). Valid values:
; list : (''boolean'') Sets whether the Categories are enclosed in an unordered list (<nowiki><ul><li></nowiki>). Valid values:
;列表: (''boolean'')设置是否在无序的列表中包含类别(<nowiki><ul><li></nowiki>)。有效的参数值:
:* <tt>TRUE</tt> (Default)
:* <tt>TRUE</tt> (Default)
:* <tt>FALSE</tt>
:* <tt>FALSE</tt>
:* <tt>正确的</tt> (默认)
:* <tt>错误的</tt>
; optiondates : (''boolean'') Sets whether to display the date of the last post in each Category. Valid values:
; optiondates : (''boolean'') Sets whether to display the date of the last post in each Category. Valid values:
; optiondates : (''boolean'')设置是否显示每个类别中的最后一篇文章的日期。有效的参数值:
:* <tt>TRUE</tt>
:* <tt>TRUE</tt>
:* <tt>FALSE</tt> (Default)
:* <tt>FALSE</tt> (Default)
:* <tt>正确的</tt>
:* <tt>错误的</tt> (默认的)
; optioncount : (''boolean'') Sets whether to display a count of posts in each Category. Valid values:
; optioncount : (''boolean'') Sets whether to display a count of posts in each Category. Valid values:
; optioncount : (''boolean'')设置是否显示每个类别中文章的数目。有效的参数值:
:* <tt>TRUE</tt>
:* <tt>TRUE</tt>
:* <tt>FALSE</tt> (Default)
:* <tt>FALSE</tt> (Default)
:* <tt>正确的</tt>
:* <tt>错误的</tt> (默认的)
; hide_empty : (''boolean'') Sets whether to hide (not display) Categories with no posts. Valid values:
; hide_empty : (''boolean'') Sets whether to hide (not display) Categories with no posts. Valid values:
;隐藏_空的 : (''boolean'')设置是否隐藏(不显示)不包含文章的类别。有效的参数值:
:* <tt>TRUE</tt> (Default)
:* <tt>TRUE</tt> (Default)
:* <tt>FALSE</tt>
:* <tt>FALSE</tt>
:* <tt>正确的</tt> (默认的)
:* <tt>错误的</tt>
; use_desc_for_title : (''boolean'') Sets whether the Category description is displayed as link title (i.e. <tt>&lt;a title="<em>Category Description</em>" href="...</tt>). Valid values:
; use_desc_for_title : (''boolean'') Sets whether the Category description is displayed as link title (i.e. <tt>&lt;a title="<em>Category Description</em>" href="...</tt>). Valid values:
;为_标题_使用_desc : (''boolean'')设置是否将类别描述设置为链接标题(例如 <tt>&lt;a title="<em>Category Description</em>" href="...</tt>)。有效的参数值:
:* <tt>TRUE</tt> (Default)
:* <tt>TRUE</tt> (Default)
:* <tt>FALSE</tt>
:* <tt>FALSE</tt>
:* <tt>正确的</tt> (默认的)
:* <tt>错误的</tt>
; children : (''boolean'') Sets whether to show children (sub) Categories. Valid values:
; children : (''boolean'') Sets whether to show children (sub) Categories. Valid values:
;子: (''boolean'')设置是否显示子(子)类别。有效的参数:
:* <tt>TRUE</tt>
:* <tt>TRUE</tt>
:* <tt>FALSE</tt> (Default)
:* <tt>FALSE</tt> (Default)
:* <tt>正确的</tt>
:* <tt>错误的</tt> (默认的)
; child_of : (''integer'') Display only the Categories that are children of this Category (ID number). There is no default.
; child_of : (''integer'') Display only the Categories that are children of this Category (ID number). There is no default.
;子: (''整数'')值显示这个类别(ID号码)的子类别。没有默认值。
; Categories : (''integer'') This parameter should be set to <tt>0</tt> (zero) when calling this template tag.  (For the curious, other values are used ''only internally'' by the tag when generating a hierarchical list.)
; Categories : (''integer'') This parameter should be set to <tt>0</tt> (zero) when calling this template tag.  (For the curious, other values are used ''only internally'' by the tag when generating a hierarchical list.)
;类别: (''整数'')当调用这个模板标签的时候,这个参数应该被设置为<tt>0</tt> (零)。(对于那些curious,只有产生层级列表的时候,标签才会''内部''使用其它参数。)
; recurse : (''boolean'') Display the list (<tt>FALSE</tt>) or return it for use in PHP (<tt>TRUE</tt>).  Defaults to <tt>FALSE</tt>.
; recurse : (''boolean'') Display the list (<tt>FALSE</tt>) or return it for use in PHP (<tt>TRUE</tt>).  Defaults to <tt>FALSE</tt>.
; recurse : (''boolean'')显示列表(<tt>正确的</tt>)或者将列表返回,用在PHP中(<tt>正确的</tt>)。默认是<tt>错误的</tt>。
; feed : (''string'') Text to display for the link to each Category's [[WordPress:Glossary#RSS|RSS2]] feed. Default is no text, and no feed displayed.
; feed : (''string'') Text to display for the link to each Category's [[WordPress:Glossary#RSS|RSS2]] feed. Default is no text, and no feed displayed.
; feed : (''string'')文本用来显示连接到每个类别的[[WordPress:Glossary#RSS|RSS2]] feed的链接。默认没有文本,没有显示feed。
; feed_image : (''string'') Path/filename for a graphic to act as a link to each Category's RSS2 feed. Overrides the '''feed''' parameter.
; feed_image : (''string'') Path/filename for a graphic to act as a link to each Category's RSS2 feed. Overrides the '''feed''' parameter.
; feed_图像 : (''string'')一个图形的路径/文件名,作为连接到每个类别的RSS2 feed的链接。取消'''feed''参数。
; exclude : (''string'') Sets the Categories to be excluded. This must be in the form of an array (ex: <tt>'1, 2, 3'</tt>).
; exclude : (''string'') Sets the Categories to be excluded. This must be in the form of an array (ex: <tt>'1, 2, 3'</tt>).
; 排除 : (''string'')设置需要被排除的类别。必须是以一个数组的形式出现(ex: <tt>1, 2, 3</tt>)。
; hierarchical : (''boolean'') Sets whether to display child (sub) Categories in a hierarchical (after parent) list. Valid values:
; hierarchical : (''boolean'') Sets whether to display child (sub) Categories in a hierarchical (after parent) list. Valid values:
; 层级的 : (''boolean'')设置是否在一个层级列表(在母类别之后)中显示子(子)类别。有效的参数值:
:* <tt>TRUE</tt> (Default)
:* <tt>TRUE</tt> (Default)
:* <tt>FALSE</tt>
:* <tt>FALSE</tt>
:  '''Note: The hierarchical parameter is not available in versions of WordPress prior to 1.5'''
:  '''Note: The hierarchical parameter is not available in versions of WordPress prior to 1.5'''
:* <tt>正确的</tt> (默认)
:* <tt>错误的</tt>
:  '''注: 在WordPress1.5版本之前的版本中没有层级参数'''


== Related ==
== Related ==
== 相关的 ==
To use the query string to pass parameters to generate a list of Categories, see [[WordPress:Template_Tags/wp_list_cats|wp_list_cats()]]
To use the query string to pass parameters to generate a list of Categories, see [[WordPress:Template_Tags/wp_list_cats|wp_list_cats()]]
使用查询字符串,传递参数,产生类别的一个列表,请看看[[WordPress:Template_Tags/wp_list_cats|wp_列表_cats()]]


{{Tag Category Tags}}
{{Tag Category Tags}}


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

2008年6月30日 (一) 17:32的版本

模板:Deprecated

Description


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.


描述

Displays a list of Categories as links. When one of those links is clicked, all the posts in that Category will display in the appropriate Category Template dicatated by the Template Hierarchy rules. This tag works like the wp_list_cats tag, except that list_cats uses a long query string of arguments while wp_list_cats uses text-based query arguments. WordPress 2.1 saw the introduction of a new and more inclusive template tag wp_list_categories, intended to replace wp_list_cats and list_cats.


显示一列 类别 作为一列链接。 当点击任何链接的时候,属于那个类别中的所有文章会在适当的类别模板中显示,类别模板是由模板层级规则规定的。这个标签与列表_cats()的运行方式基本相似,不同的是,列表_cats()使用一个很长的论证查询字符串,然而列表_cats()使用以文本为基础的查询论证。WordPress 2.1拥有一个新的而且更具有包含性的模板标签 wp_列表_类别,试图取代 wp_list_cats and list_cats


Replace With

取代

wp_list_categories().

wp_列表_类别()


Usage

用法

%%% <?php list_cats(optionall, 'all', 'sort_column',

               'sort_order', 'file', list, optiondates, 
               optioncount, hide_empty, use_desc_for_title, 
               children, child_of, 'Categories', recurse, 
               'feed', 'feed_img', 'exclude', 
               hierarchical); ?> %%%

%%% <?php list_cats(optionall, 'all', 'sort_column',

               'sort_order', 'file', list, optiondates, 
               optioncount, hide_empty, use_desc_for_title, 
               children, child_of, 'Categories', recurse, 
               'feed', 'feed_img', 'exclude', 
               hierarchical); ?> %%%

Examples

例子

Default List

默认列表

Displays the list of Categories using default settings:

使用默认设置,显示类别列表。

<?php list_cats(); ?>

<?php list_cats(); ?>

Sorted by Category Name

根据类别名分类

Displays the list of Categories, with not all Categories linked, and sorted by Category name:

<?php list_cats(FALSE, ' ', 'name'); ?>

显示类别列表,并没有链接到所有的类别,而且是根据类别名分类的: <?php list_cats(FALSE, ' ', 'name'); ?>

Customized List with Excluded Categories

拥有已删除类别的自定义列表

Sets the list to not list all the Categories (based upon further parameters), sorts by ID in ascending order and in an unordered list (<ul><li>) without dates or post counts, does not hide empty Categories, uses Category "description" for the title in the links, does not show the children of the parent Categories, and excludes Categories 1 and 33:

设置列表不显示所有的类别(以深一层的参数为基础),以升序根据ID分类而且在一个无序类别中(<ul><li>),没有文章发表的日期或者文章的数目,不隐藏内容为空的类别,使用"描述"作为链接的标题,不显示母类别的子类别,而且删除类别1和33:

<?php list_cats(FALSE, '', 'ID',
                'asc', '', TRUE, FALSE, 
                FALSE, FALSE, TRUE, 
                FALSE, FALSE, '', FALSE, 
                '', '', '1,33', 
                TRUE); ?>


<?php list_cats(FALSE, '', 'ID',
                'asc', '', TRUE, FALSE, 
                FALSE, FALSE, TRUE, 
                FALSE, FALSE, '', FALSE, 
                '', '', '1,33', 
                TRUE); ?>


Notes on use

使用注意事项

When the 'list' parameter is set for an unordered list, the list_cats() tag automatically begins and ends with UL and each item listed as an LI.

当为一个无序的列表设置'列表'参数的时候,列表_cats()标签自动地以UL开启和关闭,而且每个类别列为一个LI

Parameters

参数

optionall
(boolean) Sets whether to display a link to all Categories. Note: This feature no longer works in WordPress 1.5.x and 2.0 but is slated to be added back at Version 2.1. Valid values:
optionall
(boolean)设置是否显示一个练级连接扫所有的类别。注:WordPress1.5x和2.0版本中不再包含这个功能,但是2.1版本中又重新添加了这个功能。有效的参数值:
  • TRUE (Default)
  • FALSE
  • 正确的 (默认的)
  • 错误的
all
(string) If optionall is set to TRUE, this defines the text to be displayed for the link to all Categories. Note: This feature no longer works in WordPress 1.5.x and 2.0 but is slated to be added back at Version 2.1. Defaults to 'All'.
所有的
(string)如果 optionall设置为真的,这定义了文本显示链接连接到所有的类别。注:WordPress1.5x和2.0中不再运行这个功能,但是2.1版本中又重新添加了这个功能。默认'所有的'
sort_column
(string) Key to sort options by. Valid values:
sort_column
(string)选项分类的关键词。有效的参数值:
  • 'ID' (Default)
  • 'name'
  • 'ID' (默认的)
  • '名称'
sort_order
(string) Sort order for options. Valid values:
分类_顺序
(string)选项的分类顺序。有效的参数值:
  • 'asc' (Default)
  • 'desc'
  • 'asc' (默认的)
  • 'desc'
file
(string) The php file a Category link is to be displayed on. Defaults to 'index.php'.
文件
(string)显示类别链接的php文件。默认'index.php'
list
(boolean) Sets whether the Categories are enclosed in an unordered list (<ul><li>). Valid values:

;列表: (boolean)设置是否在无序的列表中包含类别(<ul><li>)。有效的参数值:

  • TRUE (Default)
  • FALSE


  • 正确的 (默认)
  • 错误的


optiondates
(boolean) Sets whether to display the date of the last post in each Category. Valid values:
optiondates
(boolean)设置是否显示每个类别中的最后一篇文章的日期。有效的参数值:
  • TRUE
  • FALSE (Default)
  • 正确的
  • 错误的 (默认的)
optioncount
(boolean) Sets whether to display a count of posts in each Category. Valid values:
optioncount
(boolean)设置是否显示每个类别中文章的数目。有效的参数值:
  • TRUE
  • FALSE (Default)
  • 正确的
  • 错误的 (默认的)
hide_empty
(boolean) Sets whether to hide (not display) Categories with no posts. Valid values:
隐藏_空的
(boolean)设置是否隐藏(不显示)不包含文章的类别。有效的参数值:
  • TRUE (Default)
  • FALSE
  • 正确的 (默认的)
  • 错误的
use_desc_for_title
(boolean) Sets whether the Category description is displayed as link title (i.e. <a title="Category Description" href="...). Valid values:
为_标题_使用_desc
(boolean)设置是否将类别描述设置为链接标题(例如 <a title="Category Description" href="...)。有效的参数值:
  • TRUE (Default)
  • FALSE
  • 正确的 (默认的)
  • 错误的
children
(boolean) Sets whether to show children (sub) Categories. Valid values:

;子: (boolean)设置是否显示子(子)类别。有效的参数:

  • TRUE
  • FALSE (Default)


  • 正确的
  • 错误的 (默认的)


child_of
(integer) Display only the Categories that are children of this Category (ID number). There is no default.
(整数)值显示这个类别(ID号码)的子类别。没有默认值。
Categories
(integer) This parameter should be set to 0 (zero) when calling this template tag. (For the curious, other values are used only internally by the tag when generating a hierarchical list.)

;类别: (整数)当调用这个模板标签的时候,这个参数应该被设置为0 (零)。(对于那些curious,只有产生层级列表的时候,标签才会内部使用其它参数。)

recurse
(boolean) Display the list (FALSE) or return it for use in PHP (TRUE). Defaults to FALSE.
recurse
(boolean)显示列表(正确的)或者将列表返回,用在PHP中(正确的)。默认是错误的
feed
(string) Text to display for the link to each Category's RSS2 feed. Default is no text, and no feed displayed.
feed
(string)文本用来显示连接到每个类别的RSS2 feed的链接。默认没有文本,没有显示feed。
feed_image
(string) Path/filename for a graphic to act as a link to each Category's RSS2 feed. Overrides the feed parameter.
feed_图像
(string)一个图形的路径/文件名,作为连接到每个类别的RSS2 feed的链接。取消'feed参数。
exclude
(string) Sets the Categories to be excluded. This must be in the form of an array (ex: '1, 2, 3').
排除
(string)设置需要被排除的类别。必须是以一个数组的形式出现(ex: 1, 2, 3)。


hierarchical
(boolean) Sets whether to display child (sub) Categories in a hierarchical (after parent) list. Valid values:
层级的
(boolean)设置是否在一个层级列表(在母类别之后)中显示子(子)类别。有效的参数值:
  • TRUE (Default)
  • FALSE
Note: The hierarchical parameter is not available in versions of WordPress prior to 1.5
  • 正确的 (默认)
  • 错误的
注: 在WordPress1.5版本之前的版本中没有层级参数


Related

相关的

To use the query string to pass parameters to generate a list of Categories, see wp_list_cats()

使用查询字符串,传递参数,产生类别的一个列表,请看看wp_列表_cats()

the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

模板:PHP Function Tag Footer

Description

描述

Displays a link to the category or categories a post belongs to. This tag must be used within WordPress:The Loop.

显示文章所属的类别的连接。必须在The Loop内,使用这个标签。

Usage

用法

%%% <?php the_category('separator', 'parents' ); ?> %%% %%% <?php the_category('separator', 'parents' ); ?> %%%

Examples

Separated by Space

例子

由空格分开

This usage lists categories with a space as the separator.

这个用法用分隔符,隔开类别,列出。

<p>Categories: <?php the_category(' '); ?></p>
<p>Categories: <?php the_category(' '); ?></p>
Categories: [[WordPress:#Examples|WordPress]] [[WordPress:#Examples|Computers]] [[WordPress:#Examples|Blogging]]
类别: [[WordPress:#Examples|WordPress]] [[WordPress:#Examples|电脑]] [[WordPress:#Examples|写博客]]

Separated by Comma

用逗号分开

Displays links to categories, each category separated by a comma (if more than one).

显示类别连接,(如果多于一个类别)类别之间用逗号分开。

<p>This post is in: <?php the_category(', '); ?></p>

<p>This post is in: <?php the_category(', '); ?></p>

This post is in: [[WordPress:#Examples|WordPress]], [[WordPress:#Examples|Computers]], [[WordPress:#Examples|Blogging]]


This post is in: [[WordPress:#Examples|WordPress]], [[WordPress:#Examples|电脑]], [[WordPress:#Examples|写博客]]


Separated by Arrow

用箭头分开

Displays links to categories with an arrow (>) separating the categories. (Note: Take care when using this, since some viewers may interpret a category following a > as a subcategory of the one preceding it.)

用箭头显示类别链接(>)分开类别。(注: 使用这种方法的时候,应该注意,有的访客认为类别后面的> 是前面类别的子类别。)

<p>Categories: <?php the_category(' &gt; '); ?></p>

<p>Categories: <?php the_category(' &gt; '); ?></p>

Categories: [[WordPress:#Examples|WordPress]] > [[WordPress:#Examples|Computers]] > [[WordPress:#Examples|Blogging]]
类别: [[WordPress:#Examples|WordPress]] > [[WordPress:#Examples|电脑]] > [[WordPress:#Examples|写博客]]

Separated by a Bullet

用Bullet分开

Displays links to categories with a bullet (•) separating the categories.

使用bullet (•)分开类别,显示类别链接

%%%

Post Categories: <?php the_category(' &bull; '); ?>

%%% %%%

文章类别: <?php the_category(' &bull; '); ?>

%%%

Post Categories: [[WordPress:#Examples|WordPress]] • [[WordPress:#Examples|Computers]] • [[WordPress:#Examples|Blogging]]
文章类别: [[WordPress:#Examples|WordPress]] • [[WordPress:#Examples|电脑]] • [[WordPress:#Examples|写博客]]

Parameters

参数

separator
(string) Text or character to display between each category link. The default is to place the links in an unordered list.

;分隔符: (string)链接类别之间显示的文本或者字符。默认是将链接放在无序列表上。

parents
(string) How to display links that reside in child (sub) categories. Options are:
parents
(string)怎样显示子类别中的链接。选项有:
  • 'multiple' - Display separate links to parent and child categories, exhibiting "parent/child" relationship.
  • 'multiple' -分开显示母类别和子类别的链接,显示为"母/子"关系。
  • 'single' - Display link to child category only, with link text exhibiting "parent/child" relationship.
  • 'single' -只显示子类别链接,链接文本显示为"母/子"关系。
Note: Default is a link to the child category, with no relationship exhibited.

:注:默认是链接到子类别的一个链接,不显示关系。

Related

the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

模板:PHP Function Tag Footer


相关的

模板:标签类别标签

模板:PHP 函数标签页底文字

模板:PHP 函数 标签 页底文字