• Bonnie

    (@bonnie)


    I’ve searched all over the forums and I can’t seem to find an answer to what must be a very simple question. I can’t seem to figure out how to display the category description on the category pages. I already have the category title on there which I’m displaying using single_cat_title().
    I tried several guesses at how to display it but I can’t figure it out. Can anyone help?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Jason

    (@jason)

    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…?

    Ah I would like to know this too.
    & To display on a archive page I made….
    categoryname: categorydescription
    etc.

    me, too….

    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

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Category descriptions?’ is closed to new replies.