Codex tools: Log in / create account
Languages: English • 日本語 • (Add your language)
Contents |
Displays or returns the category title for the current page. For pages displaying WordPress tags rather than categories (e.g. "/tag/geek") the name of the tag is displayed instead of the category. Can be used only outside The Loop.
<?php single_cat_title( $prefix, $display ); ?>
<?php single_cat_title(
'prefix' => ,
'display' => true ); ?>
This example displays the text "Currently browsing " followed by the category title.
<p><?php single_cat_title('Currently browsing '); ?>.</p>
This example assigns the current category title to the variable $current_category for use in PHP.
<?php $current_category = single_cat_title("", false); ?>
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