Changeset 29728
- Timestamp:
- 01/21/08 23:00:41 (6 months ago)
- Files:
-
- 1 modified
-
post-word-count/trunk/post-word-count.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
post-word-count/trunk/post-word-count.php
r900 r29728 3 3 Plugin Name: Post Word Count 4 4 Plugin URI: http://mtdewvirus.com/code/wordpress-plugins/ 5 Description: Outputs the total number of words in all posts .6 Version: 1. 025 Description: Outputs the total number of words in all posts or the number of words in a single post. 6 Version: 1.1 7 7 Author: Nick Momrik 8 8 Author URI: http://mtdewvirus.com/ 9 9 */ 10 10 11 function mdv_post_word_count( ) {12 global $wpdb ;11 function mdv_post_word_count($single = false) { 12 global $wpdb, $id; 13 13 $now = gmdate("Y-m-d H:i:s",time()); 14 $words = $wpdb->get_results("SELECT post_content FROM $wpdb->posts WHERE post_status = 'publish' AND post_date < '$now'"); 14 15 if ($single) $query = "SELECT post_content FROM $wpdb->posts WHERE ID = '$id'"; 16 else $query = "SELECT post_content FROM $wpdb->posts WHERE post_status = 'publish' AND post_date < '$now'"; 17 18 $words = $wpdb->get_results($query); 15 19 if ($words) { 16 20 foreach ($words as $word) {
