admin管理员组文章数量:1130349
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
1 Answer
Reset to default 0You 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.
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
1 Answer
Reset to default 0You 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.
本文标签: How to custom excerpt
版权声明:本文标题:How to custom excerpt? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749045960a2307847.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论