How to custom excerpt?

admin2025-06-04  18

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.

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.

Share Improve this question asked Jan 4, 2019 at 8:23 MikeMike 1 2
  • Want to add custom limit to your content ? – Pratik Patel 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? – Krzysiek Dróżdż Commented Jan 4, 2019 at 9:58
Add a comment  | 

1 Answer 1

Reset to default 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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749045986a315894.html

最新回复(0)