0

I wanted to make the excerpt only display second or third paragraph.

I need to know. How can I make the_excerpt() only display second or third paragraph and limit the length of the except.

2
  • Want to add custom limit to your content ? Commented Jan 4, 2019 at 8:35
  • What if there are other things in the post? Images, tables, and so on? How is the "second paragraph" defined exactly? Commented Jan 4, 2019 at 9:58

1 Answer 1

0

You can explode the content of excerpt by dot. For example:

$text = "Morbi consequat tempor augue. Nec fringilla eros auctor scelerisque. Etiam in ullamcorper tellus. Sed ac dui rutrum.";
$pieces = explode(".", $text);
echo $pieces[1]; // get second sentence = Nec fringilla eros auctor scelerisque

Maybe this can help you.

1
  • Why do you get second sentence? The question is about paragraphs, not sentences. Also... Your code doesn't change output of the_excerpt() function, but explodes some constant string... Commented Jan 4, 2019 at 9:57

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.