WordPress:Template Tags/the category
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_类别(' > '); ?></p>
Separated by a Bullet
有一个Bullet分开
Displays links to categories with a bullet (•) separating the categories.
显示链接,连接到类别,用一个bullet (•)将类别分开。
%%%
Post Categories: <?php the_category(' • '); ?>
%%% %%%
文章 类被: <?php the_类别(' • '); ?>
%%%
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:
;母:(string)怎样显示子(子)类别中的链接。选项有:
- 'multiple' - Display separate links to parent and child categories, exhibiting "parent/child" relationship.
- '多个' -先母子类别分开显示链接,展示"母/子"关系。
- 'single' - Display link to child category only, with link text exhibiting "parent/child" relationship.
- '单一的' -只显示链接到子类别的链接,用链接文本展示"母/子"关系。
- 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,
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