From my mindblog: Google vs China

Total word count plugin

n: smd_article_stats | v: 0.22 | d: 737 | f: /

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

If you like my code and use it a lot, 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 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 : 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 09 | 0.1 | Initial release
  • 07 Nov 09 | 0.2 | Improved counting to ignore tags and added real-time admin-side counter (both thanks speeke)
  • 22 Feb 10 | 0.21 | Prevented error message if step mangled
  • 06 Jun 11 | 0.22 | Added paragraph wrapper to fieldset for consistency with TXP’s layout (thanks philwareham)

Credits

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

Source code

If you’d rather dig for buried treasure, you’ll need to step into the view source page.

Legacy software

If, for some inexplicable reason, you need the un-current 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.

Yoghurt pot card on Stef

Yoghurt functions better as food than as a fashion accessory