WordPress Plugins

So far I’ve only written one plugin for WordPress, Comment Analysis, which provides a suite of functions for displaying various statistics about the comments on your blog. Full details for it are below. When I get around to writing more plugins I’ll add them here.

Lorelle has suggested that plugin users should show their love by giving plugin authors money, the virtual equivalent of taking them out to dinner. This is a noble and appreciated sentiment, but I’m happy with just an occasional “Hey, thanks for doing this, you rock” comment or email. If you really feel the need to part with some of your money then it would make me really happy if you made a donation to the WWF or the Sierra Club.

Comment Analysis

This plugin contains a suite of functions which examine the comments on your blog. The plugin is now hosted in the wordpress.org repository, here:

Installation

  1. Download the appropriate version using the above link
  2. Put it into your /wp-content/plugins/ directory.
  3. Activate the plugin from your WordPress admin ‘Plugins’ page.
  4. Make use of the functions in your template (see examples below).

Function Reference

ca_comment_count()

Show total count of comments for your blog, excluding pingbacks and trackbacks.

ca_pingback_count()

Show total count of pingbacks for your blog.

ca_trackback_count()

Show total count of trackbacks for your blog.

ca_spam_count()

Show total count of comments marked as spam. (Version 2.1 only)

ca_comment_last ($format=”)

Show date of last comment. The optional parameter allows you to format the date using standard date formatting.

ca_pingback_last ($format=”)

Show date of last pingback. The optional parameter allows you to format the date using standard date formatting.

ca_trackback_last ($format=”)

Show date of last trackback. The optional parameter allows you to format the date using standard date formatting.

ca_commentor_latest ($count=10, $exclude=”, $before=’<li>’, $after=’</li>’)

Shows latest $count commentors, with links to their websites if provided. $exclude is a comma separated list of commentors not to include in the list. $before and $after define the tags which will be output at the start and end of each line.

ca_commentor_most ($count=10, $exclude=”, $before=’<li>’, $after=’</li>’, $before_count=’(‘, $after_count=’)')

Show the top $count commentors, with links. $exclude is a comma separated list of commentors not to include in the list. $before and $after define the tags which will be output at the start and end of each line. $before_count and $after_count define the text which will appear around the comment comment count.

ca_comment_latest ($count=10, $length=60, $before=’<li>’, $after=’</li>’, $linktext=’Go’)

Shows the first $length chars of the latest $count comments. $before and $after define the tags which will be output at the start and end of each line. $linktext defines the text of the link which takes the user to the full comment.

ca_comment_latest_posts ($count=10, $show_count=’yes’, $before=’<li>’, $after=’</li>’, $before_count=’(‘, $after_count=’)')

Show the latest $count posts with comments (with a count of comments if $show_count is not no. $before and $after define the tags which will be output at the start and end of each line. $before_count and $after_count define the text which will appear around the comment comment count.

ca_comment_most($count=10, $show_count=’yes’, $before=’<li>’, $after=’</li>’, $before_count=’(‘, $after_count=’)')

Show the top $count commented posts (with a count of comments if $show_count is not no. $before and $after define the tags which will be output at the start and end of each line. $before_count and $after_count define the text which will appear around the comment comment count.

ca_author_most ($count=10, $exclude=”, $before=’<li>’, $after=’</li>’, $before_count=’(‘, $after_count=’)')

Show the top $count authors on your blog (with a count of posts written). I realise this isn’t comment related, but someone asked for it and I was too lazy to write a new plugin for it. $before_count and $after_count define the text which will appear around the comment comment count.

Example

To add lots of comment data to your sidebar you could edit your sidebar.php and add the following code:

<ul>
<li>Total comments: <?php ca_comment_count(); ?></li>
<li>Total pingbacks: <?php ca_pingback_count(); ?></li>
<li>Total trackbacks: <?php ca_trackback_count(); ?></li>
<li>Last comment: <?php ca_comment_last(); ?></li>
<li>Last pingback: <?php ca_pingback_last(); ?></li>
<li>Last trackback: <?php ca_trackback_last(); ?></li>
<li>Latest comments
<ul><?php ca_comment_latest(10,23); ?></ul>
</li>
<li>Latest commented posts
<ul><?php ca_comment_latest_posts(10); ?></ul>
</li>
<li>Most commented posts
<ul><?php ca_comment_most(10); ?></ul>
</li>
</ul>

98 thoughts on “WordPress Plugins

  1. Pingback: Be Lambic or Green » Comment Analysis

  2. Pingback: Comment Analysis 2.1 WP Plugin : BlogBuster

  3. This is a neat idea and very versatile looking Plugin. One tiny recommendation. Could you make the first paragraph be ALL about the Plugin and what it does and move the compensation request lower. That will help immediately explain to folks what this does and all the possibilities they can do with it. Use a lot of words. ;-) You can then delete this.

    Good luck with it!

  4. Pingback: Weblog Tools Collection » Blog Archive » WordPress Plugin Releases for 2/02

  5. Pingback: Módulos para Wordpress para el 2 de febrero - carrero Bitácora de los Hermanos Carrero, David Carrero Fernández-Baillo y Jaime Carrero Fernández-Baillo. Todo sobre Internet, Tecnología, Tendendias, Dominios, Bitácoras, Diseño y Programación, … ,

  6. Pingback: WPのプラグイン:Comment Analysis | Standing Tall

  7. Pingback: Hacks, Information, and More » WordPress Plugin Releases for 2/02

  8. I’ve got a community blog (apfelquak.de) and i’m looking for plugin similar like the function Top Commentors – but Top Authors. Something that’s showing the authors with the most postings.

    Maybe you’ve got an idea?

  9. Pingback: Plugin Parade - Reloaded » admartinator.de

  10. Pingback: links for 2007-02-03 en newdisco

  11. Pingback: Angetreten: Plugins auf Station » Station 9.111

  12. I’ve modified the Top Commentors section a little bit, because it didn’t work well.
    Better use the email address for this, because some of the commentors don’t have an URL:

    $comments=$wpdb->get_results(“SELECT comment_author_email
    , comment_author_url
    , comment_author
    , COUNT(*) cnt
    FROM $wpdb->comments
    WHERE comment_approved = ’1′
    AND comment_type NOT IN (‘pingback’,'trackback’)
    GROUP BY comment_author_email, comment_author
    ORDER BY 4 DESC”);

  13. Pingback: Anton Blog » Wordpress : add comments plugin

  14. Pingback: links for 2007-04-02 | Endl.de | Zielpublikum Weblog

  15. Pingback: The Daily Blitz » Blog Archive » Great Wordpress Plugins We Use

  16. Pingback: Wordpress guy is one month old : Wordpress guy

  17. Pingback: Die besten WordPress Plugins - Kommentare » Tipps zur Suchmaschinenoptimierung

  18. Hi, I tried to use Your plugin puttin’ the code in a text widget but it doesn’t work (as i tought). Could You suggest me something to make it work? I tried unsuccessfully EXEC-PHP. What to do? :-)

  19. Pingback: Great Wordpress Plugins We Use » The Daily Blitz

  20. Hmmm. I think I understand that [li]…

    But is it possible to write something beside the the count?

    My main problem is that if I exclude nobody, I get people with a web site and the count UNDER their name, and people without a web sit with the count BESIDES their name. It’s not very beautiful to the eye. Is it possible to always put the count UNDER the name AND to add a text besides the comment.

    Example:

    John
    (154 comments)

    Thanks.

  21. As you can see in my rightmost sidebar, all the names have the number of comments right next to them, so I’m not sure why you’re getting something different.

  22. Hi,

    I think it is because of my theme…

    But that would be ok, as long as I would be able to add some texte besides each count and be able to “format” the thing so as people with no URL would appear the same as people with URL…

    Thanks.

  23. Would you be kind enough to show me what code I could add to be able to display the count and text e.g. John (453 comments) instead of John (453)

    Thanks. Great plugin certainly.

  24. Louis, I’ve added $before_count and $after_count parameters to the functions which show counts after names. By default they are ( and ), but you can change them to whatever you want.

  25. Thank you very much!

    Where exactly do I put this?

    I tried:

    function ca_commentor_most ($count=10, $exclude=”, $before=”, $after=”, $after_count=’commentaires’) {
    global $wpdb, $comment;

    $comments=$wpdb->get_results(“SELECT comment_author_email
    , comment_author_url
    , comment_author
    , COUNT(*) cnt
    FROM $wpdb->comments
    WHERE comment_approved = ’1′
    AND comment_type NOT IN (‘pingback’,'trackback’)
    GROUP BY comment_author_email, comment_author
    ORDER BY 4 DESC”);

    $excludes=explode(‘,’, $exclude);

    foreach($comments as $comment) {
    if (!in_array($comment->comment_author, $excludes)) {
    echo $before;
    comment_author_link();
    echo ‘(‘.$comment->cnt.’)’.$after;
    if (++$ccount == $count) break;
    }
    }
    }

    but does not work… I’ll try to put the $after_count elsewhere, but I am not sure exactly where I need to put it. I don’t know much about code writing as you can see… Still learning :)

  26. Ok I’ve redownloaded the new code and I see the change you’ve made:

    … $after=”, $before_count=’(‘, $after_count=’)')…

    I tried to add text here

    $after=”, $before_count=’(‘, $after_count=’text’)')

    didn’t work

    Tried this way

    $after=”, $before_count=’(‘, $after_count=’text)’)

    didn’t work either.

    I think I should get some coding class soon… lol You must be laughing reading this :P

  27. Pingback:   Comment Analysis Plugin

  28. Pingback:   links for 2007-05-30 by SridhaReena

  29. Pingback: WordPress Plugins

  30. Excuse me, err… what’s the ‘top commentors’ code again? when i’m copiying all the codes below, theres no ‘top commentors’ included :(

    Total comments:
    Total pingbacks:
    Total trackbacks:
    Last comment:
    Last pingback:
    Last trackback:
    Latest comments

    Latest commented posts

    Most commented posts

    sorry… i’m really a newbie here :D

  31. ca_commentor_most ($count=10, $exclude=”, $before=’<li>’,$after=’</li>’,$before_count=’(‘,$after_count=’)’)

    Show the top $count commentors, with links. $exclude is a comma separated list of commentors not to include in the list. $before and $after define the tags which will be output at the start and end of each line. $before_count and $after_count define the text which will appear around the comment comment count.

  32. Pingback: Website Promotion, Affiliate Marketing and .Net Development Blog: » Blog Archive » New Blog Template And Some Behind The Scenes Changes

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree