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.
DMCunningham
Member
Posted 4 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>
relish27
Member
Posted 4 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?
deckardr
Member
Posted 4 years ago #
I got rid of the double title by changing DMC's last line above to read:
<p><?php echo category_description(); ?></p>