I use excerpts of posts in my front page. In my excerpt, the summary of the post seems to be clumped together with no spaces that are indicated in the post (e.g., paragraph spaces are automatically removed). I understand this is the default behavior.

Question: Is there a way to retain the paragraph in excerpts?

To show excerpt on the fron page in my Twenty Ten theme's loop.php I changed this (around line #137:

<?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>

with this:

<?php if ( is_home() || is_front_page() || is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>


2 Answers 2


Looks like my other answer wasn't working, so I looked into it and found this:


That article should give you all you need to keep the <p> tags in there.


The line that's important isn't likely to be the "if", it's this one:

<?php the_excerpt(); ?>

That's what spits out the content. Adding nl2br (http://php.net/manual/en/function.nl2br.php) should help return the linebreaks.

You'll have to manually echo it out, though, so you should use "get_the_excerpt()" instead.

This line should work:

<?php echo nl2br(get_the_excerpt()); ?>
  • thanks Samuel for reply. I tried replaing <?php the_excerpt(); ?> with <?php echo nl2br(get_the_excerpt()); ?>, but it did not change anything
    – Tara
    Commented Jul 17, 2011 at 4:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.