Counting of the words

n: smd_article_stats | v: 0.23 | d: 792 | f: /

Plugin documentation follows this short message from our sponsor ;-)

If you like my code and it soothes an otherwise unscratchable itch, feel free to show your appreciation with something from my UK Amazon wish list (or US) or donate to the Stef Dawson community coding pot by following the Donate button below to PayPal. Thanks!

Plugin list buttonPlugin download buttonCompressed plugin download buttonBeta plugin download button

smd_article_stats

Put this tag in your article form to display info about the current article. Tags are ignored. Note that it only displays the actual number of words entered in the article itself — if some of the content is derived from other forms, it will not be included.

Attributes

  • item : list of items you want to display. Currently choose from body, excerpt or title to get the number of words in the relevant fields
  • label : label text to output before the requested info
  • labeltag : (X)HTML tag without brackets to wrap around the label
  • wraptag : (X)HTML tag without brackets to wrap around the output
  • class : CSS classname to apply to the wraptag

Admin side

On the Write tab, the number of words in the body / excerpt are displayed in a stats panel. It is updated in real time as words are entered. The article ID is also displayed; hyperlinked to the article itself if it is live or sticky.

If you wish to move the panel to a different location on the Write tab you can manipulate a hidden preference (you could use the smd_prefalizer plugin for this task). Create a Hidden preference for your user name called smd_article_stats_pos and give it one of the following values:

  • status_above : (default location) above the Status box
  • excerpt_below : Immediately beneath the Excerpt
  • author_below : Beneath the author info (under the Excerpt)
  • title_above : above the Title box
  • textile_help_above : above the Textile Help twisty
  • textile_help_below : below the Textile Help twisty
  • none : disable the panel

Changelog

  • 24 Aug 2009 | 0.10 | Initial release
  • 07 Nov 2009 | 0.20 | Improved counting to ignore tags and added real-time admin-side counter (both thanks speeke)
  • 22 Feb 2010 | 0.21 | Prevented error message if step mangled
  • 06 Jun 2011 | 0.22 | Added paragraph wrapper to fieldset for consistency with TXP’s layout (thanks philwareham)
  • 14 Feb 2012 | 0.23 | Fixed excerpt_below auto-update mechanism ; added author_below position

Author / credits

Written by Stef Dawson. Thanks to both zem and iblastoff for the original works that this plugin borrows as its foundation.

Source code

If you’d rather wander aimlessly through thousands of lines of PHP source code, you’ll need to step into the view source page.

Legacy software

If, for some inexplicable reason, you need a prior version of a plugin, it can probably be found on the plugin archive page.

Experimental software

If you’re feeling brave, or fancy chucking your keys in the bowl, you can test out some of my beta code. It can be found on the plugin beta page.

Mavis Beacon to the rescue

Mavis Beacon Typing Tutor: Stef Edition