September 7th, 2007

Word Count Plugin for WordPress

Category: wordpress, 推介, 插件, 统计, Author: 阿七, Popularity: 12% [?]

转载自:

http://www.murraywilliams.com/software/word-count-plugin-for-wordpress/

Falling under the “if you don’t like what’s out there, do it yourself” category, I’ve written my first real WordPress plugin. (I created a plugin once to do some very customized behavior for a consulting client, but it was more some added functionality to help a custom-designed template that I’d designed. This is my first standalone general use plugin.)

What does it do? Well very very simply, it allows you to calculate and post Word Count information about a post. Specifically, it is meant to be used somewhere inside “The Loop” in a WordPress template page. You will probably want to include it in that typical “Written by John Smith on January 3rd, 2007″ summary line that precedes the_content() or you might be clever and include it in the “more” line.

To use it, simply include the mtw_wordcount() function in your PHP. Note that it returns a string, it doesn’t display it, so a typical usage would be something like:

Word Count: < ?php echo mtw_wordcount(); ?>

or more elegantly (for internationalization)

< ?php _e(’Word Count’,’mtw-wordcount’); ?>: < ?php echo mtw_wordcount(); ?>

Internationalization!
I was careful to design this plugin “the right way” which includes my first foray into internationalization. The plugin includes translation files for French, Spanish and Russian. (The other languages I know.)

Click here to download the Word Count Plugin.

什么?上面的文章不过瘾?我还特意准备了这些:

Tags:, .
评论数量(0) | Add Comments
本文网址:http://blog.designlinks.cn/wordpress/word-count-plugin-for-wordpress.html

There are No comments.

» You can leave a response or Trackback .

leave a reply