WordPress.org

Ready to get started?Download WordPress

Forums

newlines before and after excerpt (6 posts)

  1. emsdc
    Member
    Posted 10 years ago #

    I'm displaying my excerpt on my website using <?php the_excerpt(); ?>
    I'm getting a space above and below the excerpt -- it's like WP is inserting a couple line breaks above and below the excerpt. How can I remove these breaks? They're not in the html.
    BTW, the excerpt is imported from MT. I don't know if the import process somehow caused these newlines to appear. My guess is no, because when I go to the edit screen in wp-admin, I don't see any extra spaces in the excerpt field.

  2. Mark (podz)
    Support Maven
    Posted 10 years ago #

    It should be stylable from the CSS.
    Is there a specific post you can indicate that has this issue ?

  3. emsdc
    Member
    Posted 10 years ago #

    I just viewed the source code on my page and it looks like WP is putting paragraph tags around my excerpt, even though they're not in index.php.
    See http://www.ems.org/wordpress/index.php?p=4
    "Cancer Prevention Coalition" is the excerpt. I'm using the excerpt field to specify a "source" for each post, since the source is sometimes different than the author on my site.
    This doesn't look to be a CSS issue to me. It looks like the CMS has something built into it that assumes an excerpt is its own paragraph.

  4. Mark (podz)
    Support Maven
    Posted 10 years ago #

    .storycontent p {
    margin: 2px 0 2px 0;
    }
    That will reduce the top and bottom margins to 2px, but you cal alter those around obviously.

  5. emsdc
    Member
    Posted 10 years ago #

    This still creates an unwanted line break. Paragraph tags create a line break, even if the margins are set to zero.

  6. emsdc
    Member
    Posted 10 years ago #

    I figured this out... I just needed to comment out this line...
    add_filter('the_excerpt', 'wpautop');
    ...in template-functions-post.php

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.