Tutorial: How to add Twitter Link to Wordpress Comments

Feb 24th, 2009 | By JJ Kennedy | Category: Howto's & Tutorials, Video, Web Design

This video is designed to help you add a twitter id field to your comments section, and to have the visitors twitter ID show up as a reply link in their comment.

The link to the original tutorial is below. I made this video if you are too retarded to follow his excellent instructions and screw it up like I did. I’ll show you where the screw up point are, and what to do when you do screw up.


Thanks goes to Darren Rowse at ProBlogger.net for the original tutorial.

1. You will need to download and install the Extra Comment Fields plugin available here. Thanks to the folks at the Idea Shower for that one.

2. Install and setup the plugin.

3. Insert this snippet into your comments.php file. This is the snippet that adds the Twitter ID field to your comment form. Location of form is probably towards the bottom of your comments.php file somewhere. Look for the comment_author_url statement, and that will give you an idea where to put it.

Here is the code to insert:

<input id="“twitter”" name="“twitter”" size="“22″" type="“text”" tabindex="“4″" /> <label for="“twitter”"><small>Twitter ID</small></label>

3. Insert this snippet also into your comments.php file. This is the snippet that shows the visitors Twitter ID in their comment and links it for a reply. This will probably be towards the top of the comments.php file. You will want it before the comment_text() argument.

<?php if ($comment->extra_twitter) {
// Strip out the @ if they put it there because we’re going to need to get rid of it for the url anyway
$extra_twitter = preg_replace("/^@/", "", $comment->extra_twitter);
$extra_twitter = htmlentities($extra_twitter); ?>
My Twitter<a href="http://twitter.com/<?=$extra_twitter ?>">@<?=$extra_twitter?></a>

<?php } // extra_twitter ?>

Tags: , , , , , , ,

6 comments
Leave a comment »

  1. See. It’s works. Cool hunh?

  2. This advice is really going to help, thanks.

  3. Glad I could help. Like I said, it took a little screwing with to get to work right with non-standard themes.

    I’m certainly no code expert, but let me know if I can help with anything.

    JJ

  4. Haha, “big squishy jugs” – dude, with that and your Warlock screens, you are officially a geek and that is way okay by me! :)

    Cheers for the video, taking time to check out the rest of your blog now :)

  5. Hi,
    Thanks for the video. It sure helped me.
    As understood form the video, you were using wordpress 2.7.xx or lower. Do you know how to get the plugin to work for 2.8.4?
    I tried using it but the plugin seems to be malfunctioning. The problem i am facing is that none of the comments show up on the dashboard when the plugin is active. I took your trouble shooting advice and found that no table was created in the database.
    I guess things have become more complex after wordpress shifted some functionality to comment-template.php!

    Thanks
    Temi

  6. very nice tuts. i worked as u did. but after pasting 3 snippet. my page sidebar,comment box is gone. how to put the the twitter id enabled. plz.
    note i dont have comment_text() arugment.
    and the twitter id field is seen but after enabling the 3rd snippt. my site page collapse. iam using elegantthemes. the other tutorial using twit-ip id plugin also it wont working (according to problogger.com) so plz help me in this.
    in this video the yare puting b4 the comment_text() arugment. but i dont have. plz plz. iam twitter adict and i want ot put it. plz plz help in this.

Leave Comment