Codex tools: Log in / create account
Languages: English • 日本語 • (Add your language)
Contents |
Displays a link to the category or categories a post belongs to. This tag must be used within The Loop.
<?php the_category( $separator, $parents, $post_id ); ?>
How to Pass Tag Parameters: Tags with PHP function-style parameters
false (the current post).
This usage lists categories with a space as the separator.
<p>Categories: <?php the_category(' '); ?></p>
Displays links to categories, each category separated by a comma (if more than one).
<p>This post is in: <?php the_category(', '); ?></p>
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>
Displays links to categories with a bullet (•) separating the categories.
<p>Post Categories: <?php the_category(' • '); ?></p>
wp-includes/category-template.php
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, get_the_category, get_category_parents, get_category_link, is_category, in_category