using <?php get_the_category(); ?>
doesnt seem to do anything.
anyone else? … i just want to display as plain text the name of the category im in, for example, i want to say: Currently viewing: ‘category name’
thanks again
<?php echo get_the_category(); ?>
that doesnt work either, i just get the words: Array
thats because the post has more then one category then it returns an array.
try
`<?php
$cats=get_the_category();
if( is_array($cats) )
print_r($cats);
else
echo $cats;
?>
thats because the post has more then one category then it returns an array.
try
<?php
$cats=get_the_category();
if( is_array($cats) )
print_r($cats);
else
echo $cats;
?>
the post is only in 1 category and when i try that code i get
Array ( [0] => stdClass Object ( [term_id] => 11 [name] => Out and about [slug] => out-and-about [term_group] => 0 [term_taxonomy_id] => 11 [taxonomy] => category [description] => [parent] => 0 [count] => 1 [object_id] => 25 [cat_ID] => 11 [category_count] => 1 [category_description] => [cat_name] => Out and about [category_nicename] => out-and-about [category_parent] => 0 ) )
<p><?php single_cat_title('Category:'); ?></p>
or
<?php
$cats=get_the_category();
echo $cats[0]->cat_name;
?>
Info:
http://codex.wordpress.org/Template_Tags/single_cat_title
http://codex.wordpress.org/Template_Tags/get_the_category