5ThirtyOne

Derek Punsalan

Media Temple

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 This assumes you’re using the default Kubrick theme 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.

9 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. 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. I have really got to try this plugin. Maybe this will get me to sort out the mess that is my comments section.

  4. 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. A very helpful post, thanks.

  6. Thank you man for this.

    Very nice.

    Working Like a Charm.

Leave a comment

Comments may be held for moderation. If your comment does not appear immediately, do not repost. I reserve the right to remove any inappropriate or off-topic comments. If you plan on sharing helpful code, please pass it through Postable first. Want other to know who you are? Register a Gravatar.

Connect

Syndicate

Subscribe via RSS or Email

Advertisement

Skribit Suggest (info)

9rules network

Categories