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. I would like to display the last comments posted, followed by the name of the person who posted them and the blog post title to which they related. How can I do that?

  2. ana, ca_comment_latest will do most of that for you, but it doesn’t show the title of the blog post the comment is related to. If I get a chance I’ll add an option to do that.

  3. hi lambic, i ave been using your plugin for a week and it works very great! thanks a lot for creating such a handy plugin.

    can i use the ‘$exclude=’ option for the ‘ca_comment_most”? i have some posts that i wanna exclude in the generated list.

    and what variables should i fill in on the ‘$exclude=’? can i use the post_ID?

    thanks so much.

  4. Thank you

    can i use the ‘$exclude=’ option for the ‘ca_comment_most”? i have some posts that i wanna exclude in the generated list.

    and what variables should i fill in on the ‘$exclude=’? can i use the post_ID?

    this code

  5. thanks for the great plugin. just wondering is it possible to have option to remove the nofollow in the links? for example used together with ca_comment_most to encourage readers to post more comments.

  6. Do you have a way to restrict the “Most Commented Posts” (ca_comment_most) to a specific time frame? If not, what do you think the best way to go about that would be?

    I’m after something for the last 24 hours and can’t think of an efficient way to do it.

  7. I’ve added two new parameters to ca_comment_most:

    $exclude – can contain a comma separated list of post IDs to exclude from the query

    $hours – if this is not zero then the query will only look at comments posted in the last $hours hours.

  8. Pingback: Innstikk som blir brukt på norske plugins | Norske plugins

  9. I don’t do any styling, you’ll need to define your own class for whatever structure you choose to use to display the results. By default I output lists with <li> tags around each item, so you can add a class to your <ul> definition, or you can override that default and use whatever structure you wish.

  10. Pingback: Online Seo Service » Wordpress Plugins

  11. Pingback: Wordpress 2.5 Uyumlu Eklentiler (Liste) | Wordpress Tema Ve Eklenti

  12. Pingback: wordpress 2.5 Uyumlu Eklentiler Listesi | Nazlı Reklam Reklam ve Hosting

  13. Pingback: Wordpress 2.5 Uyumlu Eklentiler Listesi | Taha'nın Yeri

  14. Great plugin! Congrats!:) I’m using version 2.1 and found a bug – in ca_author_most left bracket cannot be displayed because of spelling error in the plugin file. Probably you found that years ago. Anyway, thank you very much, you rock!:)

  15. Pingback: Advice for the noob in choosing the best WordPress Plugins | Alex Higgins Blog

  16. Pingback: Wordpress 2.5+ Uyumlu Eklentiler (Liste) - Yorumla.Net

  17. I think it’s good to reimburse guys who create such amazing plugins for the rest of us to use for nothing. But it really is up to them. I appreciate your heart on this thing, and I’m glad you mentioned at least some option – donating to the WWF or Sierra. As for the plugin, it seems nice and neatly done. A lot of plugins can be quite a pain, because the rough edges don’t seem to be ironed out very well or whatever. This looks like it might be a good one.

  18. Pingback: Wordpress eklenti listesi | h7x Software & Technology Center

  19. Pingback: WordPress Plugins: Comment Analysis at WordPress Today

  20. Ok, I think this is a really great plug in and quite what I am looking for.

    I put it in my ui.tabs.php and am getting quite frustrated.

    What happens is this:

    total comments, pings and tracks works fine, without causing troubles of any sorts.

    last comment, last ping and last track also work fine.

    latest comments and last commented post cause major havoc. either seperately or together: I end up getting the actual URL of the last commentor pasted into my theme (under the comments), and if I click on another person’s name (another commentor), then I get that URL.

    What on earth is happening? Can I clear this up? Or does it simply not work with my theme? Or do I need to put it elsewhere?

    Much appreciation for your help, suggestions and tips.

    Andrea

  21. Andrea, first of all, I don’t know what a ‘ui.tabs.php’ is, but I’m assuming it’s part of your theme?

    It’s hard to tell what your problem is. Maybe you can send me how you’ve coded it?

  22. Sorry for not replying, I lost track of this comment and am glad to have found my way back.

    The ui.tabs is the file card in the top of the theme. I put the comments in the sidebar so now I am pleased. Thanks for the great plugin!

  23. Pingback: Wordpress 2.5 ile Uyumlu Eklentiler (Liste halinde) | AskinMekani.Net

  24. Is it possible to specific a date range…specifically if I wanted to show the most commented posts within the last month (only)?

    Thanks!

  25. Pingback: Furkan Kadıoğlu Website » Wordpress Liste Halinde Eklentiler

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