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.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI 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.
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.
the_excerpt()
function, but explodes some constant string...
– Krzysiek Dróżdż♦
Jan 4 '19 at 9:57