{"id":33,"date":"2005-01-14T02:09:49","date_gmt":"2005-01-14T07:09:49","guid":{"rendered":"http:\/\/lee.org\/blog\/archives\/2005\/01\/14\/words-in-post\/"},"modified":"2006-10-12T15:36:07","modified_gmt":"2006-10-12T22:36:07","slug":"words-in-post","status":"publish","type":"post","link":"https:\/\/www.lee.org\/blog\/2005\/01\/14\/words-in-post\/","title":{"rendered":"Created and Installed Words in Post Plugin"},"content":{"rendered":"<p>I&#8217;m proud to present my first WordPress plugin, Words in Post. All it does is count up the number of the words in a post and spit them out. By sticking this code in the index.php template of WordPress, I can create a title line that looks like this:<\/p>\n<p><code>Geekery \u00ef\u00bf\u00bd 49 words \u00ef\u00bf\u00bd lee @ 2:50 am<\/code><\/p>\n<p>This is better than using the following simple grab that I had heard about <a href=\"http:\/\/wordpress.org\/support\/topic.php?id=9808#post-59200\">here<\/a>. <\/p>\n<p><code>&lt;?php echo(str_word_count(get_the_content())); ?&gt; words<\/code><\/p>\n<p>The preceding doesn&#8217;t grab anything past the <code>&lt;!--more--&gt;<\/code> and counts tags incorrectly.<\/p>\n<p>Thanks to <a href=\"http:\/\/mtdewvirus.com\/wp-hacks\/\">Nick Momrik<\/a> for the inspiration.<\/p>\n<p>&nbsp;<\/p>\n<p>1-15-05 update: Version 1.1. Thanks to Alderete&#8217;s suggestion, the function returns a number instead of echoing. See the php for instructions.<\/p>\n<p><a href=\"http:\/\/lee.org\/blog\/images\/words_in_post.phps\">Download Words in Post plugin version 1.1 here<\/a>. Rename it from .phps to .php and run with it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m proud to present my first WordPress plugin, Words in Post. All it does is count up the number of the words in a post and spit them out. By sticking this code in the index.php template of WordPress, I can create a title line that looks like this: Geekery \u00ef\u00bf\u00bd 49 words \u00ef\u00bf\u00bd lee [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,6],"tags":[],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-general","category-wordpress"],"_links":{"self":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":0,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lee.org\/blog\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}