WordPress.org

Ready to get started?Download WordPress

Forums

Show cat description in Archive (5 posts)

  1. bohoe
    Member
    Posted 7 years ago #

    Im trying to get the dewscription showing in archives.php
    I have tried a couple of things and read in the forum but cant seem to get it right.

    I would like to show it as follows:

    <?php if (have_posts()) : ?>

    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h1>Articles in '<?php echo single_cat_title(); ?>'</h1>
    [CAT_DESCRIPTION CODE HERE]

    Anyone?
    If there is a post resolving this, I missed it, so let me know.

  2. bohoe
    Member
    Posted 7 years ago #

    Anybody?

  3. DMCunningham
    Member
    Posted 6 years ago #

    The following works for me:

    <?php if (have_posts()) : ?>
    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h1>Articles in '<?php echo single_cat_title(); ?>'</h1>
    <?php /* below is what you are looking for */ ?>
    <p><?php echo category_description(single_cat_title()); ?></p>
  4. relish27
    Member
    Posted 6 years ago #

    i'm trying to do the same thing. the code above, dm, actually just displays the single_cat_title again for me. instead, i want the category description below the cat title. any thoughts?

  5. deckardr
    Member
    Posted 6 years ago #

    I got rid of the double title by changing DMC's last line above to read:
    <p><?php echo category_description(); ?></p>

Topic Closed

This topic has been closed to new replies.

About this Topic