$field->words()

Returns the number of words in the text

  • return (integer)

Example

<?= $page->text()->kirbytext() ?>

<dl class="text-stats">

  <dt>Characters</dt>
  <dd><?php $page->text()->length() ?></dd>

  <dt>Words</dt>
  <dd><?php $page->text()->words() ?></dd>

</dl>