excerpt($text, $length = 140, $mode = 'chars')
Creates an excerpt of any text by a given character or word length
-
$text (string)
-
$length (int)
Length in characters/words -
$mode (chars' or 'words)
Mode of the $length parameter -
return (string)
Example
// Limit to 300 characters
<?= excerpt($page->text(), 300) ?>
// Limit to 20 words
<?= excerpt($page->text(), 20, 'words') ?>