WordPress.org

Forums

Removing <p></p> from the_excerpt() output? (5 posts)

  1. ApexDesignChief
    Member
    Posted 6 years ago #

    I am having trouble with the html that WordPress adds to things like excerpts and such.

    I have kind of a tight layout in mind and when I call the_excerpt() from within the Loop, WordPress encases the given excerpt in <p> tags when displaying in the browser. Also does this to the post content when I use the_content()

    This is causing vertical height problems in my layout, I don't want the extra blank lines in there.

    Is there a way to customize the output of these WP tags? I looked in the post-template.php file but couldn't grasp what it was doing :(

    Any help would be much appreciated!

  2. Jorge A. Gonzalez
    Member
    Posted 5 years ago #

    I am having the same sort of issues.

  3. alchymyth
    Forum Moderator
    Posted 5 years ago #

    use:
    <?php echo get_the_excerpt(); ?>
    in place of:
    <?php the_excerpt(); ?>

  4. alexlr
    Member
    Posted 5 years ago #

    This worked perfectly. Was looking for the exact same thing. Thank you!

  5. pushpinderbagga
    Member
    Posted 5 years ago #

    lol works like a gem ... thanks a lot!

Topic Closed

This topic has been closed to new replies.

About this Topic