• Curious why (in template/archive.php):

    <h2 class=”pagetitle”><?php echo category_description(single_cat_title()); ?></h2>

    Produces:

    <h2>Category Title<p>Description of category</p></h3>

    Is another (better) way of getting category descriptions to appear in Archives?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter swortis

    (@swortis)

    Odd.. The first post went blank..

    Anyway, my question was why adding the following into template/archive.php:

    <h2 class=”pagetitle”><?php echo category_description(single_cat_title()); ?></h2>

    Produces:

    <h2 class=”pagetitle”>Category Title<p>Category Description</p></h2>

    (in other words, why the paragraph tag?)

    Is there any other way of getting Category Descriptions to appear on an Archive?

    I have this issue with category descriptions too. It seems to have been introduced with 2.3.

    ps: i’m using “strip_tags” to get around the bug for now:

    <?php echo strip_tags(category_description()); ?>

    Thread Starter swortis

    (@swortis)

    <?php echo strip_tags(category_description()); ?> worked beatifully.

    I use this:

    <h2 class=”pagetitle”><?php single_cat_title(); ?>
    <span><?php echo strip_tags(category_description()); ?></span></h2>

    ..and then style away in the CSS (use – span {display:block;} – to get the category description onto the next line)

    Thanks all!

    interesting, if you’re surrounding the description in span tags, then why not just restyle the <P> tags in that area to display:inline; and margin:0;?

    Ivonvic: because <h2><p>title</p></h2> isn’t valid XHTML.

    This is a bug, not a feature. 🙂

    if you restyle the p tag, you won’t need the H2 at all.

    Header tags exist for a reason. You don’t want to break the semantic web, now do you Ivovic? 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘single_cat_title adding paragraph tag’ is closed to new replies.