How-to: Improve WordPress Subscribe to Comments

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.

Discuss - 18 Comments

  1. Excellent stuff. I never really thought about it but you are right it could be missed. BTW, it is one of my favorites also.

  2. Montoya says:

    Heh, I did this fix on my site and never really gave it a second thought. It’s a good thing you’ve provided this tutorial to anyone who is thinking of using the plugin; the option definitely should go before the button.

  3. Adam says:

    I have really got to try this plugin. Maybe this will get me to sort out the mess that is my comments section.

  4. Mark Jaquith says:

    Very nice tutorial.

    I don’t like the default placement either. Unfortunately, in the “default” and “classic” WordPress themes, and in many other themes, the “hook” that Subscribe to Comments uses is placed below the “submit” button. The main use of the hook is to insert extra form elements, and I can’t imagine why you’d want the form elements to be under the submit button.

    Instead of placing the show_subscription_checkbox(); call manually, you could also move the comment form hook up to the desired location. That way any other plugins that use the hook will also be able to place their form elements above the submit button.

  5. Gio says:

    A very helpful post, thanks.

  6. […] the checkbox checked as a default setting but as I think this should be an opt-in feature. This article will show you how to make the change by adding a one-line code to your comment.php […]

  7. […] subscribe to comments system, and found exactly that in Subscribe to Comments 2.1 as recommended by Derek Punsalan (who also explains a little bit of customisation of the […]

  8. […] Subscribe To Comments – IMHO the most important plugin to install. Allowing readers to subscribe to your comments makes it much easier to follow conversations. To place the “Subscribe to comments via email” checkbox above the Submit button, check out Derek Punsalan’s post at 5ThirtyOne. […]

  9. Nehemoth says:

    Thank you man for this.

    Very nice.

    Working Like a Charm.

  10. […] How to Improve WordPress Subscribe to Comments […]

  11. kai says:

    how about a “subscribe to all comments” option, its a pain to have to comment on every post and then subscribe to comments for every post too.

  12. niv says:

    why didn’t you implement it on your own blog?

    • Derek says:

      Thanks for the reminder. I’ve changed the theme on the site a few times which changed the placement of the the subscription option.

  13. DéCé says:

    This is just great, thx for the usefull tweak!

  14. Cdin says:

    Just added plugin. But the plugin didn’t add the necessary line to my theme comment.php. However, because of your wonderful post, manually added the line the way you recommended. Fannn-tastic!

    What a great plugin and post! Thanks!

    : )

  15. Natalia Usselman says:

    the code in above post was removed – textarea with id “comment” does not exist anymore. I tried to stick the PHP line show_subscription_checkbox(); in every form I found with no results.