Changeset 1303365
- Timestamp:
- 12/08/2015 11:04:29 PM (9 years ago)
- Location:
- comment-word-count
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
comment-word-count/trunk/comment-word-count.php
r155533 r1303365 2 2 /* 3 3 Plugin Name: Comment Word Count 4 Plugin URI: http ://wordpress.org/extend/plugins/comment-word-count/4 Plugin URI: http/plugins/comment-word-count/ 5 5 Description: Outputs the total number of words in all comments. 6 Version: 1. 026 Version: 1. 7 7 Author: Nick Momrik 8 8 Author URI: http://nickmomrik.com/ … … 11 11 function mdv_comment_word_count() { 12 12 global $wpdb; 13 13 14 $words = $wpdb->get_results("SELECT comment_content FROM $wpdb->comments WHERE comment_approved = '1'"); 14 if ($words) { 15 foreach ($words as $word) { 16 $comment = strip_tags($word->comment_content); 17 $comment = explode(' ', $comment); 18 $count = count($comment); 15 if ( $words ) { 16 $oldcount = 0; 17 foreach ( $words as $word ) { 18 $comment = strip_tags( $word->comment_content ); 19 $comment = explode( ' ', $comment ); 20 $count = count( $comment ); 19 21 $totalcount = $count + $oldcount; 20 22 $oldcount = $totalcount; 21 23 } 22 24 } else { 23 $totalcount =0;25 $totalcount0; 24 26 } 25 echo number_format($totalcount); 27 28 echo number_format( $totalcount ); 26 29 } 27 ?> -
comment-word-count/trunk/readme.txt
r248712 r1303365 2 2 Contributors: nickmomrik 3 3 Tags: comments, count, words 4 Stable tag: trunk 4 Stable tag: 1.1 5 Tested up to: 4.4 5 6 6 7 Outputs the total number of words in all comments.
Note: See TracChangeset
for help on using the changeset viewer.