get_the_category only displays 'Array'
-
I’ve spend a bunch of hours on this matter and I just can’t seem to resolve it so now I’m turning to the forums. Hope somebody can help me here.
In short: I use the Arras Theme (www.arrastheme.com, most ppl on their forum seem to be on vacation and I’m not blaming them haha) which uses filters.php to display what they call ‘nodes’ (content blocks really) which consist of a thumbnail and the title of the post underneath.
All I want is to display the category a post belongs to as well. On top of the title, below the thumbnail. I got that going with get_the_category but one problem: it literally displays the words ‘Array’. How can I make it show ‘Category name’?!
This is de code I have used to display the darn thing:
function arras_categoryCUSTOM($page_type) { global $post; $category = get_the_category(); echo '<h3 class="entry-title">' . $category->cat_name . '</h3>'; /* echo $category->cat_name; */ }
And then this to get it into the node:
$postheader .= '<h3 class="entry-title">' . get_the_category() . '</h3>'; $postheader .= '<h3 class="entry-title"><a href="' . get_permalink() . '" rel="bookmark">' . get_the_title() . '</a></h3>';
- The topic ‘get_the_category only displays 'Array'’ is closed to new replies.