Support » Fixing WordPress » category descriptions

  • Resolved strugglefish


    Hi all. I’ve googled, codexed, even yahoo’d. Please forgive me if this has already been addressed.

    I can’t seem to get WordPress 2.0.1 to display category description when view ing a post category.

    I’ve tried a number of examples that I found, but none work. Could someone paste the php template code that would out put this like:

    (description here)

Viewing 6 replies - 1 through 6 (of 6 total)
  • Try:

    global $wp_query;
    $category = $wp_query->get_queried_object();
    <?php echo $category->cat_name; ?><br />
    (<?php echo $category->category_description; ?>)

    Thanks for the reply, but nothing happens with that code. Any other ideas?

    Where are you running the code? Is it being added in a category template (category.php)?

    It is in my page.php that I would like to display the category description underneath the main header for the category.

    so it would look like
    Category name here
    (category description here)

    [first post in category here]
    [second post in category here]

    I’ve disabled all plugins to verify that there isn’t a conflict, and the code still doesn’t work.

    I appreciate your help.

    Running PHP 4.3.11 and Mysql 4.0+, Apache2

    But what is the code? As Pages are not organized under categories, I assume you’re trying to display a category archive list.

    Look at the part of whatever you’re using to see how it collects the category name. That should point out how to also get the description.

    And note my suggestion above relies on the category query template for use. It will not work elsewhere (without some serious recoding).

    Oh, I’m using the archive.php file. Sorry about that.
    The code used to pull the category title is:

    <h1><?php echo single_cat_title(); ?></h1>

    Ok, I’m an idiot newb. I see my error now. Thank you for your kindness.

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