How-to: Improve WordPress Subscribe to Comments

  • May 3rd, 2006

One of my favorite WordPress plugins [hands down] is Subscribe to Comments by Mark Jaquith and Jennifer (ScriptyGoddess). The plugin allows readers to subscribe to comment activities via email bypassing the need to bookmark or subscribe [via RSS] to particular posts. As with any well written WordPress plugin, installation is a simple two step process: upload & activate. Done deal. The plugin automatically inserts a new “Subscribe to comments via e-mail” option conveniently located below the “Submit Comment” button in your comments.php template.

subscribe via email

Personally, I believe the option placement is a little backwards. Why offer the option to subscribe via email below the submit button? Naturally, after typing a response, my immediate inclination is to click “Submit Comment” without taking notice of anything else in the area. I recommend repositioning the option directly below the comment textarea and immediately above the “Submit Comment” button. Doing so will allow a readers eyes to naturally pass from the textarea, to the option, and finally down to the button. Thankfully, we’re dealing with a WordPress plugin which allows the average user to extract the necessary information from the plugin itself.

Assuming you’ve downloaded and unzipped the plugin, let’s open the subscribe-to-comments.php file in the plain text editor of your choice. The only string of text we’re interested in is located on line 25:

function show_subscription_checkbox ($id='0') {

Highlight show_subscription_checkbox and copy to your clipboard. Next, we’re going to specify where we want the option to appear for regular readers. Feel free to insert the option wherever you see fit. For this particular tutorial, we’re going to add the option directly below the comments textarea (and immediately above the “Submit Comments” button. So, let’s open up comments.php and look at line 94 [between the textarea and submit button]. To avoid the nitty gritty, let me remind you that WordPress is written in PHP, this means that simply pasting the code taken from above will not work. Depending on your template, the general code should look something along the lines of:

<p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>
<?php show_subscription_checkbox(); ?>
<p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />

Recognize the show_subscription_checkbox? You have now repositioned the subscription option from the default to it’s new home. It is essential that the call be somewhere within the WordPress loop.

.subscribe-to-comments {}

If you feel like styling the comment subscription option, keep in mind that the output is wrapped in <p> tags.