My First WordPress Plugin – Recent Comments

0 Flares Twitter 0 Facebook 0 Google+ 0 0 Flares ×
Intro LcF’s Recent Comments: I don’t understand why people like to have recent comments shows the comment text instead of the post title.

My recent comment plugin display in format of nickname @ post title. ‘Nickname’ will be linked to comment author’s website(if submited), ‘post title’ will be linked to the comment’s permalink, AND mouseover it to preview the comment text!

Updated (2005-04-22): This script works on WordPress 1.5!

Not really my original work… I have forgotten the orginal author name. The script is using in previous version of WordPress where no plugin support(put in my-hacks.php). I modified it to have my own style of displaying recent comments.

Now I upgraded to WordPRess 1.2.2 (works in WP1.5), I think it is time to dump the old my-hack.php and use only Plugin. I need to convert the script into a WordPress plugin…

Well, it is much simpler than I thought. In fact, no need to modify single bit of the code. I just add some plugin comments and save the file as lcf_recent_comment.php. :)

Dump the file into my wordpress plugin folder, then goto “Plugins” under WordPress Admin, and my plugin is listed there! Activate it, and add lcf_get_recent_comments(); php function(don’t complain about the function name, initially it is MY function. :P) into template. Done!

If you like the recent comment list in my blog(see it?), you can download here.

Hope you like it! Any feedback is welcome!

0 Flares Twitter 0 Facebook 0 Google+ 0 0 Flares ×

67 Responses to My First WordPress Plugin – Recent Comments

  1. Leona March 14, 2005 at 11:37 am #

    thanks for the plugin, works great!

  2. David July June 1, 2005 at 6:53 am #

    I would love to have the ability to truncate the topic title to an ellipsis if it is longer than x characters.

    For example:
    Commenter @ This is a really long…

  3. Boldt June 18, 2005 at 10:00 pm #

    I have installed your plugin, but have some problems.

    I want only the first 10-15 words of the comment shown so I have added this:

    ‘, true) ?>

    but the complete comment is shown. what is wrong?


  4. Boldt June 18, 2005 at 10:02 pm #

    sorry the line didn’t show correct

    lcf_get_recent_comments(10, 25, ”, ”, true)

  5. Boldt June 19, 2005 at 5:58 pm #

    found the bug/error

    Line 41 in lcf_get_recent_comments.php where output is defined:

    replace “$comment_content” with “$comment_excerpt”

  6. Sylvain June 23, 2005 at 5:10 pm #

    Jeeeeeeeeeeeeeeezuz! Been looking for that like a mad man! Great work! You’re on my “Acknowledgments” roll! :-)

  7. LcF June 23, 2005 at 5:35 pm #

    @Sylvain: glad that you like it too. :)

  8. mgirl November 13, 2005 at 9:12 pm #

    Been searching the last hour for the perfect comment plugin and i found it here.. thanks LCF. you rock.

  9. JH November 27, 2005 at 12:13 pm #

    Hey LcF:

    Fantastic plugin. I spent a good two hours looking for a tool that would allow me to do exactly what yours does. After I had nearly given up all hope…I found you. Many, many thanks.

    I’d like to make a slight modification, if it doesn’t offend, but don’t know how. Perhaps you can help?

    I don’t want the comment author’s to link to their url in the menu (it will still be linked from the comment itself). How do I adjust to code so only the comment title itself is a hotlink, not the author’s name?

    Also, I attempted to change the number of comments listed (from 5 to 7) and it generate a host of error messages from wordpress about the header already being generated.

    I’m a complete novice when it comes to this stuff, so any assistance you can offer will be greatly appreciated.


  10. aHfUi December 23, 2005 at 11:00 pm #

    Thanks your plug-in
    It is nice ^___^

  11. stchatterbox January 3, 2006 at 1:16 pm #

    good if you could add a gravatar beside the commenter!

  12. LcF January 3, 2006 at 1:35 pm #

    thank you for the suggestion, stchatterbox.

  13. Pande January 7, 2006 at 4:51 pm #

    Your plugin is great. Works perfect on WordPress 2.0 too.

  14. Rado Vleugel January 9, 2006 at 5:38 pm #

    Hey LcF,

    Thanks for this plugin. I have a question: Is there a way to list also the comments made on pages (I have for example a Guest Book with a template that makes use of the same comment-code as the normal post-pages)? At this moment only comments made on posts are listed.


  15. sadkas January 24, 2006 at 9:34 pm #

    hi your plugin is very useful. but i want to prevent seek website name. what can i do?

  16. Marcela April 21, 2006 at 11:44 am #

    hello LcF,

    Is this plugin compatible iwth wp 2? thanks.

  17. LcF April 21, 2006 at 1:34 pm #

    Yes, the plugin should works with WordPress 1.5 and above.

  18. John Wong June 22, 2006 at 12:29 am #

    Nice plugin! Will implement it soon! Thanks for your contributions!

  19. yemendiary June 22, 2006 at 6:01 am #

    Fantastic! Works like a charm. FYI for whom need the exact code to add to your sidebar, here ya go:

    [Note: Code is ripped automatically by WordPress... ]

    Add the above to top and bottom portions of code in the sidebar.

  20. Jonna December 17, 2006 at 9:58 am #

    Personally, I just dont git. how couple most people not understand all of this? Anyway. My 2pennies : )


  21. Ian C. December 20, 2006 at 11:16 pm #

    Nice – thanks :)

  22. Quang Minh December 26, 2006 at 3:28 am #

    Thanksssssssssssssssss a lot man :D
    I love the simplicity of your plugin, I only need 2 thing for the recent comment: author + topic link; and your plugin provided it, simple and yet effective.

    Just one small thing to point out, sometimes the author is “Anonymous”, your plugin will show “” (blank) in the author name, I modified it a liite bit to show “Anonymous” instead of blank name :D Maybe you want to consider it to update the plugin. Otherwise, it’s PERFECT :)

    Thanks again, and Happy new Year :)

  23. Sherly February 13, 2007 at 4:11 pm #

    Thanks for the nifty plugin, it is running perfectly in my website. I also modified the code to display Anonymous just like what Quang MIngh suggested :

    “if ($comment->comment_author != “”){
    $comment_author = stripslashes($comment->comment_author);
    else {$comment_author=’Anonymous’;}”

  24. alex February 17, 2007 at 6:13 pm #

    Hi, Thanks Liew for the plugin. I have it up and running on my blog. Marcela, I’m using WordPress 2.1, so it should be no problem with WordPress 2.0. ;-)

  25. Maryland March 7, 2007 at 1:21 pm #

    This nice is very good, i will recomend it to my friends and partners

  26. Tom September 15, 2007 at 11:00 pm #

    Line 41 in lcf_get_recent_comments.php where output is defined:

    replace “$comment_content” with “$comment_excerpt”
    need helppp


  1. Yvonne Foong’s Blog » Wordpress shifted and New Additions - June 30, 2005

    [...] ess blog. The priority of a post depends on its comments. More comments, higher priority! RECENT COMMENTS- As what it is called. This plugin [...]

  2. 无聊小站 » Blog Archive » 我用的plugins - October 14, 2006

    [...] LCF Recent Comments [...]

  3. 10 Essential Plug-ins for WordPress version 2.1 : - March 6, 2007

    [...] Recent Comments – shows recent comments with link back to commenter’s site and link to comment (by Liew Cheon Fong and available on his blog) [...]

  4. 10 Essential Plug-ins for WordPress Version 2.1 - Meta Tags : - March 15, 2007

    [...] Recent Comments – shows recent comments with link back to commenter’s site and link to comment (by Liew Cheon Fong and available on his blog) [...]

Add a comment

0 Flares Twitter 0 Facebook 0 Google+ 0 0 Flares ×