Have you tried category_description()?
Thread Starter
Bonnie
(@bonnie)
Yes, I’ve tried that one – I didn’t get an error on the main category pages like with other tags, it just didn’t display anything.
Thread Starter
Bonnie
(@bonnie)
Does anyone else have any ideas? Or is this function not yet supported…?
Anonymous
Ah I would like to know this too.
& To display on a archive page I made….
categoryname: categorydescription
etc.
Did you try using category_description() with specified category_id? like this: category_description($some_cat_id)
I’m also trying to get this working – I’ve noticed that wp_list_cats() generates the list of categories and sticks each category description into the title of each link.
So, somewhere in the wp_list_cats() function in wp-includes/template-functions-category.php there’s a bit of code that we can surely adapt to be a simple print_cat_des() function, right?
[ I have almost no idea what PHP’s up to, so why it’s not possible to swop a few words from this hack is beyond me… ]
Line 186 in template-functions-category.php defines category_description($category = 0), but that seems to be doing naff all – how about down on line 343 where it uses
$link .= 'title="' . htmlspecialchars($category->category_description) . '"';
to put in the title for the category link? But I have no idea how to mung this into a workable function. Little help?
Try
<?php category_description('1'); ?>
to get the desc for the category with id = 1
It should work.
this works, but does not display the title before the description