<p>What you want to achieve is not an easy task because you would have to hook into many different events to recognize new blocktypes.</p>

<p>The fastest and easiest method would be to use this plugin as the base of your own <a href="https://github.com/mmikkel/CpFieldLinks-Craft/blob/master/README.md" rel="nofollow noreferrer">https://github.com/mmikkel/CpFieldLinks-Craft/blob/master/README.md</a>. You can edit the init function to show the script for everyone and not just administrators. Then you use the plugins Javascript function as your base script <a href="https://github.com/mmikkel/CpFieldLinks-Craft/blob/master/source/javascripts/CpFieldLinks.js" rel="nofollow noreferrer">https://github.com/mmikkel/CpFieldLinks-Craft/blob/master/source/javascripts/CpFieldLinks.js</a> and change the <code>editFieldBtn</code> template to display not the handle of your field but a custom variable. This variable will be the total word count. </p>

<p>You have to select all your needed fields with jquery (inspect the html in order to find out what selectors you can use) and use a word count script.</p>

<p>I`ve created something similar a few months ago and did the same. It was relatively easy compared to do all the work from zero </p>

CC BY-SA 3.0
2017-12-03T14:01:59.980Z
2017-12-03T14:01:59.980Z
Robin Schambach
<p>For rendered outputs, you can use <a href="https://wordsmith.docs.topshelfcraft.com/guide/statistics.html" rel="nofollow noreferrer">Wordsmith's Text Statistics &amp; Readability</a> module to output integers needed. Also comes with some useful backend filters / tests.</p>
<p>For seeing word/character count in the backend while editing, set the plain text field to &quot;<a href="https://plugins.craftcms.com/redactor" rel="nofollow noreferrer">Redactor</a>&quot; and use a Custom Redactor Config to remove the formatting buttons and turn on the &quot;Counter&quot; plugin:</p>
<p><code>{ &quot;plugins&quot;: [&quot;counter&quot;, &quot;limiter&quot;], &quot;buttons&quot;: [&quot;html&quot;], &quot;formatting&quot;: [&quot;&quot;], &quot;limiter&quot;: 160, &quot;cleanOnEnter&quot;: true, &quot;pastePlainText&quot;: true }</code></p>
<p>Note: the above &quot;limiter&quot; plugin will remove the ability to paste into the field with ctrl+v though rightclick+paste still works (and will exceeds the limiter amount). Also, this may output a <code>&lt;p&gt;&lt;/p&gt;</code> but you can use <a href="https://twig.symfony.com/doc/3.x/filters/striptags.html" rel="nofollow noreferrer">Twig striptags</a> to strip all tags from the field: <code>entry.fieldname|striptags</code></p>

CC BY-SA 4.0
2023-01-26T17:08:54.650Z
2023-01-26T17:08:54.650Z
franklylately
<p>You'll need to add a plugin like <a href="https://github.com/doublesecretagency/craft-cpjs" rel="nofollow noreferrer">this one from Lindsey DiLoreto</a> that allows you to insert your own javascript into the CP.  Then you'll need to write some javascript that counts up each word in a textarea input for each block.  I'm sure stackoverflow has several answers on how to do that.  Keep in mind Craft already has jQuery installed if you choose to use it.</p>

CC BY-SA 3.0
2017-12-03T13:51:35.170Z
2017-12-03T13:51:35.170Z
Ryan
<p>Any way to show the total word count in real-time to authors while they are writing an entry that has multiple blocks? </p>

<p>I don't need per-block word count ... I need total word count shown in real-time.</p>

<entries><matrix>
How to Show the Total Word Count of an Entry?
# How to Show the Total Word Count of an Entry?

(Asked by: username_0 on 2017-12-03)

Any way to show the total word count in real-time to authors while they are writing an entry that has multiple blocks?

I don't need per-block word count ... I need total word count shown in real-time.

**Tags:** entries, matrix


---

## 3 answers

### Answer by username_1 on 2017-12-03. Score: 1 | Accepted answer

What you want to achieve is not an easy task because you would have to hook into many different events to recognize new blocktypes.

The fastest and easiest method would be to use this plugin as the base of your own <https://github.com/mmikkel/CpFieldLinks-Craft/blob/master/README.md>. You can edit the init function to show the script for everyone and not just administrators. Then you use the plugins Javascript function as your base script <https://github.com/mmikkel/CpFieldLinks-Craft/blob/master/source/javascripts/CpFieldLinks.js> and change the `editFieldBtn` template to display not the handle of your field but a custom variable. This variable will be the total word count.

You have to select all your needed fields with jquery (inspect the html in order to find out what selectors you can use) and use a word count script.

I`ve created something similar a few months ago and did the same. It was relatively easy compared to do all the work from zero


---

### Answer by username_2 on 2023-01-26. Score: 1

For rendered outputs, you can use [Wordsmith's Text Statistics & Readability](https://wordsmith.docs.topshelfcraft.com/guide/statistics.html) module to output integers needed. Also comes with some useful backend filters / tests.

For seeing word/character count in the backend while editing, set the plain text field to "[Redactor](https://plugins.craftcms.com/redactor)" and use a Custom Redactor Config to remove the formatting buttons and turn on the "Counter" plugin:

`{ "plugins": ["counter", "limiter"], "buttons": ["html"], "formatting": [""], "limiter": 160, "cleanOnEnter": true, "pastePlainText": true }`

Note: the above "limiter" plugin will remove the ability to paste into the field with ctrl+v though rightclick+paste still works (and will exceeds the limiter amount). Also, this may output a  but you can use [Twig striptags](https://twig.symfony.com/doc/3.x/filters/striptags.html) to strip all tags from the field: `entry.fieldname|striptags`


---

### Answer by username_3 on 2017-12-03. Score: 1

You'll need to add a plugin like [this one from Lindsey DiLoreto](https://github.com/doublesecretagency/craft-cpjs) that allows you to insert your own javascript into the CP. Then you'll need to write some javascript that counts up each word in a textarea input for each block. I'm sure stackoverflow has several answers on how to do that. Keep in mind Craft already has jQuery installed if you choose to use it.


---

