WordPress.org

Forums

category_description return <p> tag (7 posts)

  1. Marcomail
    Member
    Posted 5 years ago #

    If is use echo category_description() i show the correct category description, but wordpress insert <p> at the start of the string and at the end...

  2. MichaelH
    Member
    Posted 5 years ago #

    One example:

    <?php
    //display category name/description for use in category template
    if ( is_category() ) {
    $cat = get_query_var('cat');
    $category=get_category($cat);
    echo '<p>Category Title/Name: '. $category->name . '</p>';
    echo '<p>Category Description: '. $category->description . '</p>';
    }
    ?>
  3. Marcomail
    Member
    Posted 5 years ago #

    But i'm using category description in meta description, so i'm not interested show the <p> tag :(

  4. MichaelH
    Member
    Posted 5 years ago #

    echo $category->name;

    or

    $myvalue = $category->name;

  5. Marcomail
    Member
    Posted 5 years ago #

    Thanks, but why echo category_description()

    return <p> tag ?

  6. morestar
    Member
    Posted 5 years ago #

    I'm looking for the same fix.

    I want to edit whatever file generates category_description();

  7. dannybcastillo
    Member
    Posted 5 years ago #

    Add:

    ...remove_filter('term_description','wpautop'); in your theme's functions.php...

    This is the link back to the support post I found.
    LINK

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.