snippet_by_word_count — Return a substring of the text by limiting the word count.
Summary
- snippet_by_word_count($text, $maxWords = 20, $ellipsis = '...')
Return a substring of the text by limiting the word count.
Note: it strips the HTML tags from the text before getting the snippet
- Parameters:
$text (
string)$maxWords (
int)$ellipsis (
string)
- Returns:
string