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 was wondering if it was possible to get the first two paragraphs and the feature image in the excerpt.

I currently have the first 100 words, but would like the the first two paragraphs.

What I want to achieve is something like Smashing Magazine, where the first paragraph is one font, and the second is the base, while and image is in-between. (http://smashingmagazine.com)

I know you can do this with the manual excerpt too, but that's way too tedious!

share|improve this question

Check out this tutorial: http://jshamsul.com/2012/02/08/wordpress-get-first-paragraph-from-post/

There the author puts all the paragraphs into array. So you could possibly pull out the first, second, thrid... paragraphs from that array.

As for smashingmagazine.com styling the first paragraph. They do it with CSS :first-child pseudo-class like this:

p:first-child {
/* your styles */

More info about :first-child - https://developer.mozilla.org/en-US/docs/CSS/:first-child

You could also style the second paragraph with :nth-child like this:

p:nth-child(2) {
/* your styles */

More info about :nth-child - https://developer.mozilla.org/en-US/docs/CSS/:nth-child

share|improve this answer

AFAIK, you can only set the number of words that come in the excerpt using the excerpt_length filter. But I found this post worth a read for you, might help.

share|improve this answer

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.