How To Mimic The WPTavern Commenting System

Over the past few days, I’ve had a couple of people ask me what plugins I use to accomplish my commenting system here on WPTavern.com. I’m not a fan of using a third party system so in no particular order, here are the plugins I use.

Akismet – I’ve had no problems with Akismet taking care of spam comments on this site.

Comment Quicktags Reloaded – This plugin provides the formatting buttons to the comment form.

Filosofo Comments Preview – This plugin enables a live preview of the comment before it’s published.

Subscribe To Comments – Enables users to checkmark a box to receive notifications of new comments

WP Ajax Edit Comments – This is one of my favorite plugins because it provides a very easy way for visitors to edit their own comments. It also has built in support for After The Deadline meaning commenters can spell check before submission. It’s a commercial plugin but well worth the price.

Secret Sauce:

There is one particular feature of the WPTavern comment form that makes it a little unique. For each comment, there is a Reply link. When a visitor clicks this link, something like the following shows up: @Jeffro – The @ symbol as used by Twitter means you’re replying to someone specifically. The comment number is the unique comment ID and will link to the comment being replied to so the conversation is coherent. Last but not least the comment authors name is bolded.

I have Kaspars Dambis to thank for adding this functionality to the site which was originally part of the WP Comment Remix plugin that won the WeblogToolsCollection plugin competition in 2008.

Now here is where it gets tricky. This functionality is not part of a plugin but is code that has been added to my child themes functions.php file. I don’t know where you would add this code in your own theme to achieve the same functionality but if someone could use it as a starting point and create a plugin that just does this, that would be cool.

/**
 * Custom comment meta. Adds a custom comment reply link.
 *
 * @since 0.2
 */
function tavern_news_comment_meta( $meta ) {
    return str_replace( '', ' [tavern-comment-reply-link before=" | "]', $meta );
}

/**
 * Shortcode for displaying a comment reply link.  A better solution would be to find a 
 * script that works within the WordPress comment system.
 *
 * @since 0.2
 */
function tavern_news_comment_reply_shortcode( $attr ) {
    $attr = shortcode_atts( array( 'before' => '', 'after' => '' ), $attr );

    $out = $attr['before'];

    $out .= ""; $out .= $attr['after']; return $out; }

12 Comments


  1. I think that people are well used to the @ sign with a name next to it @name , it’s common in comments. Me too, I prefer to add the code in my functions.php file whenever possible, instead of installing another plugin, due to a speed of my blog and also then there is a sort of an ownership feeling to it like that. A comment preview available as you type is out there as well, I saw it somewhere. Thank you.

    Report


  2. Very cool. The comments look nice and are very easy to use! May have to use some of these plugins in the future. Good job!

    Report


  3. With that @ reply thing, that mean that I won’t have threaded comments at all? I can’t decide if I rather have threaded comments or the @ reply thing

    Report


  4. @Jesse Friedman – After commenting, what do you think?

    @Brandon Mullins – This is the way I do it. Of course, you can simply use Disqus or IntenseDebate to do the same things. In fact, IntenseDebate has their own plugin architecture so you can go above and beyond my commenting system.

    @Anne – I think it’s the easiest way to say ‘Hey, I’m talking to you’ in a sea of noise. That code is in my functions.php file but it’s coded in such a way that it’s specific to my child theme based on the Hybrid framework. Messing around with the code, I’m sure you could figure out a way to lift the Javascript bits for your own site.

    @Octavian – Not sure what you mean by Tweeter but in a sense, you get threaded comments, just not as visually as you’re used to.

    @Daniel – On my site, I’ve chosen not to use threaded comments because that would introduce a second Reply link. The custom one I have and the one WordPress has by default. I liked the functionality of my link better. Although you won’t see the conversation threaded normally, the conversation still maintains threads thanks to the Comment ID link added to the beginning of replies so everyone knows which comment is being responded to.

    @Aldo – I haven’t used that plugin and was not aware of it but upon browsing around, are all those options only available to the administrator and not to everyone? That makes a big difference.

    Report


  5. @Jeffro

    All those options are available only in the backend.
    The reader can click on two links (or buttons): Reply and Quote. The Reply link make the same thing you describe in your post, while the Quote copy the commenter’s text in the textform area.

    Report


  6. Jeffro, Thanks for sharing these plugins. I also like WordPress Conditional CAPTCHA. It redirects spam-flagged comments to a CAPTCHA page. If CAPTCHA is entered correctly, comment gets moved to moderation queue. Pretty useful for me since my site is swarmed by spam-bots, all of whom fail to pass CAPTCHA.

    By the way, is it possible to use WP Ajax Edit Comments but without the Ajax effect?

    @Anne – Problem is — when you put everything in functions.php — when you switch themes, you’ll have to manually port functionality to the new theme. With plugins, you don’t have that problem.

    Report


  7. @M.K. Safi – The way I get around that is by keeping custom functions in a directory inside wp-content, separate to themes or plugins, then using the theme’s functions.php to just call the other files. This way, you can organise functions eg. comment-functions.php, nav-functions.php etc which makes it easy to identify code snippets. Then just include by calling through functions.php. Its a safe way of having custom functions that work across different themes, without the risk of deleting them if you change themes.

    Report

Comments are closed.