WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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. ?>


share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer

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()); ?>
share|improve this answer
thanks Samuel for reply. I tried replaing <?php the_excerpt(); ?> with <?php echo nl2br(get_the_excerpt()); ?>, but it did not change anything – Tara Jul 17 '11 at 4:43
Thanks Samuel. Appreciate your help – Tara Jul 17 '11 at 7:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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