single_cat_title deprecated in wordpress 2.7
Function single_cat_title() displays or returns the category title for the current page. For pages displaying WordPress tags rather than categories (”/tag/geek”) the name of the tag is displayed instead of the category.
Usage (only outside The Loop):
<?php single_cat_title('prefix', 'display'); ?>
Next example assigns the current category title to the variable $current_category for use in code:
<?php $current_category = single_cat_title("", false); ?>
for wordpress 2.7 or newer version use get_the_category function instead of single_cat_title. get_the_category() returns an array of objects, one object for each category assigned to the post.
single_cat_title “simulation” Usage (outside the loop ; single.php):
<?php $category = get_the_category(); $current_category = $category[0]->cat_name; ?>
Categories: Blogs, Bookmarks, PhP, Tech, Wordpress code, current category, get_the_category, PhP, programming, single.php, single_cat_title, Wordpress, wordpress 2.7








