模板: 标签 类别 标签:修订间差异
(新页面: == Description == Displays a link to the category or categories a post belongs to. This tag must be used within WordPress:The Loop. == Usage == %%% <?php the_category('separator', ...) |
无编辑摘要 |
||
第1行: | 第1行: | ||
== Description == | == Description == | ||
== 描述 == | |||
Displays a link to the category or categories a post belongs to. This tag must be used within [[WordPress:The Loop]]. | Displays a link to the category or categories a post belongs to. This tag must be used within [[WordPress:The Loop]]. | ||
显示文章所属的类别的连接。必须在[[WordPress:The Loop|The Loop]]内,使用这个标签。 | |||
== Usage == | == Usage == | ||
== 用法== | |||
%%% <?php the_category('separator', 'parents' ); ?> %%% | |||
%%% <?php the_category('separator', 'parents' ); ?> %%% | %%% <?php the_category('separator', 'parents' ); ?> %%% | ||
第10行: | 第15行: | ||
===Separated by Space=== | ===Separated by Space=== | ||
== 例子 == | |||
===由空格分开=== | |||
This usage lists categories with a space as the separator. | This usage lists categories with a space as the separator. | ||
这个用法用分隔符,隔开类别,列出。 | |||
<pre><p>Categories: <?php the_category(' '); ?></p></pre> | |||
<pre><p>Categories: <?php the_category(' '); ?></p></pre> | <pre><p>Categories: <?php the_category(' '); ?></p></pre> | ||
<div style="border:1px solid blue; width:50%; padding:10px">Categories: [[WordPress:#Examples|WordPress]] [[WordPress:#Examples|Computers]] [[WordPress:#Examples|Blogging]]</div> | <div style="border:1px solid blue; width:50%; padding:10px">Categories: [[WordPress:#Examples|WordPress]] [[WordPress:#Examples|Computers]] [[WordPress:#Examples|Blogging]]</div> | ||
<div style="border:1px solid blue; width:50%; padding:10px">类别: [[WordPress:#Examples|WordPress]] [[WordPress:#Examples|电脑]] [[WordPress:#Examples|写博客]]</div> | |||
===Separated by Comma=== | ===Separated by Comma=== | ||
===用逗号分开=== | |||
Displays links to categories, each category separated by a comma (if more than one). | 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> | ||
<p>This post is in: <?php the_category(', '); ?></p> | |||
<div style="border:1px solid blue; width:50%; padding:10px">This post is in: [[WordPress:#Examples|WordPress]], [[WordPress:#Examples|Computers]], [[WordPress:#Examples|Blogging]]</div> | <div style="border:1px solid blue; width:50%; padding:10px">This post is in: [[WordPress:#Examples|WordPress]], [[WordPress:#Examples|Computers]], [[WordPress:#Examples|Blogging]]</div> | ||
<div style="border:1px solid blue; width:50%; padding:10px">This post is in: [[WordPress:#Examples|WordPress]], [[WordPress:#Examples|电脑]], [[WordPress:#Examples|写博客]]</div> | |||
===Separated by Arrow=== | ===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.) | 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> | ||
<p>Categories: <?php the_category(' &gt; '); ?></p> | |||
<div style="padding: 10px; width: 50%; border:solid 1px blue">Categories: [[WordPress:#Examples|WordPress]] > [[WordPress:#Examples|Computers]] > [[WordPress:#Examples|Blogging]]</div> | <div style="padding: 10px; width: 50%; border:solid 1px blue">Categories: [[WordPress:#Examples|WordPress]] > [[WordPress:#Examples|Computers]] > [[WordPress:#Examples|Blogging]]</div> | ||
<div style="padding: 10px; width: 50%; border:solid 1px blue">类别: [[WordPress:#Examples|WordPress]] > [[WordPress:#Examples|电脑]] > [[WordPress:#Examples|写博客]]</div> | |||
===Separated by a Bullet=== | ===Separated by a Bullet=== | ||
===用Bullet分开=== | |||
Displays links to categories with a bullet (•) separating the categories. | Displays links to categories with a bullet (•) separating the categories. | ||
使用bullet (•)分开类别,显示类别链接 | |||
%%% <p>Post Categories: <?php the_category(' &bull; '); ?></p>%%% | %%% <p>Post Categories: <?php the_category(' &bull; '); ?></p>%%% | ||
%%% <p>文章类别: <?php the_category(' &bull; '); ?></p>%%% | |||
<div style="padding: 10px; width: 50%; border:solid 1px blue">Post Categories: [[WordPress:#Examples|WordPress]] • [[WordPress:#Examples|Computers]] • [[WordPress:#Examples|Blogging]]</div> | <div style="padding: 10px; width: 50%; border:solid 1px blue">Post Categories: [[WordPress:#Examples|WordPress]] • [[WordPress:#Examples|Computers]] • [[WordPress:#Examples|Blogging]]</div> | ||
<div style="padding: 10px; width: 50%; border:solid 1px blue">文章类别: [[WordPress:#Examples|WordPress]] • [[WordPress:#Examples|电脑]] • [[WordPress:#Examples|写博客]]</div> | |||
== Parameters == | == Parameters == | ||
== 参数 == | |||
; separator : (''string'') Text or character to display between each category link. The default is to place the links in an unordered list. | ; 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'') How to display links that reside in child (sub) categories. Options are: | ||
; parents : (''string'')怎样显示子类别中的链接。选项有: | |||
:* <tt>'multiple'</tt> - Display separate links to parent and child categories, exhibiting "parent/child" relationship. | :* <tt>'multiple'</tt> - Display separate links to parent and child categories, exhibiting "parent/child" relationship. | ||
:* <tt>'multiple'</tt> -分开显示母类别和子类别的链接,显示为"母/子"关系。 | |||
:* <tt>'single'</tt> - Display link to child category only, with link text exhibiting "parent/child" relationship. | :* <tt>'single'</tt> - Display link to child category only, with link text exhibiting "parent/child" relationship. | ||
:* <tt>'single'</tt> -只显示子类别链接,链接文本显示为"母/子"关系。 | |||
: Note: Default is a link to the child category, with no relationship exhibited. | : Note: Default is a link to the child category, with no relationship exhibited. | ||
:注:默认是链接到子类别的一个链接,不显示关系。 | |||
== Related == | == Related == | ||
第55行: | 第111行: | ||
{{PHP Function Tag Footer}} | {{PHP Function Tag Footer}} | ||
== 相关的 == | |||
{{标签类别标签}} | |||
{{PHP 函数标签页底文字}} |
2008年8月16日 (六) 13:41的最新版本
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>
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>
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(' > '); ?></p>
<p>Categories: <?php the_category(' > '); ?></p>
Separated by a Bullet[ ]
用Bullet分开[ ]
Displays links to categories with a bullet (•) separating the categories.
使用bullet (•)分开类别,显示类别链接
%%%
Post Categories: <?php the_category(' • '); ?>
%%% %%%
文章类别: <?php the_category(' • '); ?>
%%%
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,