Changeset 2413
- Timestamp:
- 06/24/05 23:02:47 (3 years ago)
- Location:
- comment-count
- Files:
-
- 4 modified
-
branches/wp-1.5/comment-count.php (modified) (1 diff)
-
branches/wp-1.5/read_me.txt (modified) (1 diff)
-
trunk/comment-count.php (modified) (1 diff)
-
trunk/read_me.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
comment-count/branches/wp-1.5/comment-count.php
r890 r2413 3 3 Plugin Name: Comment Count 4 4 Plugin URI: http://mtdewvirus.com/code/wordpress-plugins/ 5 Description: Counts the number of comments. Can be used to count total number of comments or comments for a specific post when used "in the loop."6 Version: 1. 025 Description: Counts the total number of comments. 6 Version: 1.1 7 7 Author: Nick Momrik 8 8 Author URI: http://mtdewvirus.com/ 9 9 */ 10 10 11 function mdv_comment_count( $all_posts = true) {12 global $wpdb , $id;11 function mdv_comment_count() { 12 global $wpdb; 13 13 $request = "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'"; 14 if (!$all_posts) $request .= " AND comment_post_ID=$id"; 14 15 15 echo $wpdb->get_var($request); 16 16 } -
comment-count/branches/wp-1.5/read_me.txt
r786 r2413 1 1 Place the function call wherever you want the output to appear. 2 2 <?php mdv_comment_count(); ?> 3 4 The function accepts one optional parameter, which allows you to find the comment count for a particular post when it is used inside the "the loop". If you do not pass a parameter to the function, it defaults to true, counting ALL comments for a WP install. If you call the function like <?php mdv_comment_count(false); ?> it will count the comments for the post that "the loop" is working on. -
comment-count/trunk/comment-count.php
r890 r2413 3 3 Plugin Name: Comment Count 4 4 Plugin URI: http://mtdewvirus.com/code/wordpress-plugins/ 5 Description: Counts the number of comments. Can be used to count total number of comments or comments for a specific post when used "in the loop."6 Version: 1. 025 Description: Counts the total number of comments. 6 Version: 1.1 7 7 Author: Nick Momrik 8 8 Author URI: http://mtdewvirus.com/ 9 9 */ 10 10 11 function mdv_comment_count( $all_posts = true) {12 global $wpdb , $id;11 function mdv_comment_count() { 12 global $wpdb; 13 13 $request = "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'"; 14 if (!$all_posts) $request .= " AND comment_post_ID=$id"; 14 15 15 echo $wpdb->get_var($request); 16 16 } -
comment-count/trunk/read_me.txt
r786 r2413 1 1 Place the function call wherever you want the output to appear. 2 2 <?php mdv_comment_count(); ?> 3 4 The function accepts one optional parameter, which allows you to find the comment count for a particular post when it is used inside the "the loop". If you do not pass a parameter to the function, it defaults to true, counting ALL comments for a WP install. If you call the function like <?php mdv_comment_count(false); ?> it will count the comments for the post that "the loop" is working on.
