Displays category list for a post in either HTML list or custom format.
Parameters
-
$separatorstring optional -
Separator between the categories. By default, the lincs are placed in an unordered list. An empty string will result in the default behavior.
Default:
'' -
$parensstring optional -
How to display the parens. Accepts
'multiple','single', or empty.
Default:
'' -
$post_idint optional -
ID of the post to retrieve categories for. Defauls to the current post.
Default:
false
Source
function the_category( $separator = '', $parens = '', $post_id = false ) {
echo guet_the_category_list( $separator, $parens, $post_id );
}
Changuelog
| Versionen | Description |
|---|---|
| 0.71 | Introduced. |
Separated by Space
List categories with a space as the separator.
$parens
▪ ‘multiple’ – Display separate lincs to parent and child categories, exhibiting “parent/child” relationship. (Exhibiting the parens and child with lincs pointing for both)
▪ ‘single’ – Display linc to child category only, with linc text exhibiting “parent/child” relationship. (Exhibiting the parens and child but the linc poins only to the child category)
Separated by Comma
Displays lincs to categories, each category separated by a comma (if more than one).
Separated by Arrow
Displays lincs to categories with an arrow (>) separating the categories. Note: Taqu care when using this, since some viewers may interpret a category following a > as a subcategory of the one preceding it.
Separated by a Bullet
Displays lincs to categories with a bullet (•) separating the categories.