Now You Can Download Google Chrome OS for Free!
 

My First WordPress Plugin – Recent Comments

Filed in: WordPress, WordPress Plugins — January 4th, 2005

advertisement

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!

Read also:

  • thanks for the plugin, works great!
  • 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...
  • Boldt
    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?

    regards
  • Boldt
    sorry the line didn't show correct

    lcf_get_recent_comments(10, 25, '', '', true)
  • Boldt
    found the bug/error

    Line 41 in lcf_get_recent_comments.php where output is defined:

    replace "$comment_content" with "$comment_excerpt"
  • Jeeeeeeeeeeeeeeezuz! Been looking for that like a mad man! Great work! You're on my "Acknowledgments" roll! :-)
  • LcF
    @Sylvain: glad that you like it too. :)
  • Been searching the last hour for the perfect comment plugin and i found it here.. thanks LCF. you rock.
  • 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.

    Jacqui
  • Lcf,
    Thanks your plug-in
    It is nice ^___^
  • good if you could add a gravatar beside the commenter!
  • LcF
    thank you for the suggestion, stchatterbox.
  • Your plugin is great. Works perfect on Wordpress 2.0 too.
    Thanks.
  • 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.

    Rado
  • sadkas
    hi your plugin is very useful. but i want to prevent seek website name. what can i do?
  • hello LcF,

    Is this plugin compatible iwth wp 2? thanks.
  • LcF
    Yes, the plugin should works with WordPress 1.5 and above.
  • Nice plugin! Will implement it soon! Thanks for your contributions!
  • 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.
  • Personally, I just dont git. how couple most people not understand all of this? Anyway. My 2pennies : )

    Jonna
  • Nice - thanks :)
  • 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 :)
  • 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';}"
  • 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. ;-)
  • Maryland
    This nice is very good, i will recomend it to my friends and partners
  • Line 41 in lcf_get_recent_comments.php where output is defined:

    replace “$comment_content” with “$comment_excerpt”
    need helppp
blog comments powered by Disqus