CommentLuv Premium: Add Custom Twitter Field to WordPress Comment Form

I was busy installing CommentLuv Premium on two of my blogs last week and noticed that even though the plugin supports direct integration and modification of the WordPress Theme comment form, this functionality did not work as desired for the two blogs I installed CommentLuv Premium on.


I tried with 3.0 Theme Form type and Alternative and couldn’t get CommentLuv Premium to auto insert the Twitter field properly.

So I found that creating a very easy template, I was able to use this custom code very quickly and easily to insert the Twitter field into my existing comment form.

Step 1 – Open Comments.php

Find this line:

<p><input type=”text” name=”url” id=”url” value=”<?php echo $comment_author_url; ?>” size=”22″ tabindex=”3″ />
<label for=”url”><small>Website</small></label></p>

Step 2 – Insert New Line In Comments.php

Simply add this line under the previous line:

<p><input type=”text” name=”atf_twitter_id” id=”atf_twitter_id” value=”<?php echo esc_attr($atf_twitter_id); ?>” size=”22″ tabindex=”4″ /><label for=”atf_twitter_id”>Twitter (@Username without the @)</label><br></p>

Step 3 – Select Manual Twitter Field CommentLuv TwitterLink Section


Save changes.

Step 4 – Tweak CSS if needed:

Now this code worked perfectly on two blogs I used it on, but I did have to add some CSS styling like margin-left tags to help space out the new input field so it lined up with the others properly.

Personally I think putting the Twitter Name field into the form instead of as a separate form entry under the submit button is easier for the readers and helps prevent the field from being missed on mobile devices where the screen is so much smaller a reader may not even see the Twitter field under the submit button.

-Dragon Blogger

Share Feedback We Want to Hear From You