About two weeks ago, the WordPress.com team released a wonderful new tool called the Follow Button to all theirs WordPress.com users. This button is floating in the bottom-right corner of a blogs and let readers subscribing, by email, to the blog’s publications. Each time a new blog post is published, they receive an update in their inbox.

The idea is far from new, and may even looks like old-school. However, the implementation they did is simple, really well done and really clever. Also, the wording they used in the tool is perfect (for example, using the word Follow instead of Subscribe).

The only problem is that this wonderful new tool is only available for WordPress.com users! As you may know, this blog is using WordPress, but it is a self-hosted instance. After doing some research, I couldn’t find any plugins or methods to install it on my blog. Also, the email service under this user interface is built into WordPress.com. As last resort, I checked their Jetpack plugin, to see if it got added the Follow Button to it, but apparently they didn’t (it is probably too recent).

So, I was in a dilemma: I wanted this feature for my blog, I didn’t want to migrate everything to WordPress.com, and I didn’t had the time to write a plugin that does exactly this. So what I did is to take a few hours to hack my own Follow Button using what is already existing out there. In fact, I have been quite surprised to see how easy it turned out to be.

It as been as easy as installing the really good Subscribe2 plugin and to create the UI, from the original Follow Button using some HTML, CSS and JQuery code. After some re-wiring, I ended-up with my own self-hosted Follow Button.

This is what I want to share with you here, in this [raw]Hors Série[/raw] blog post. I am pretty sure that many self-hosted WordPress blogger will want it, so I took an additional hour to write and publish this blog post.

I did two additional “improvements” to the concept:

  1. I changed the icon to put some color in there. Not only to make it less dull, but also to bring a little bit mo attention to it.
  2. I also added a link to my RSS feed. To me, “Follow” is not just about emails, but it is also about other syndication mediums too. However, I kept the email as the first option to keep the spirit of the tool.

Finally, I didn’t want to hack any piece of code in WordPress nor in any other WordPress plugin. The only thing that we will modify is the theme, by adding some code to it. The current implementation could be improved by upgrading Subscriber2 for example, but I didn’t want people to have to do this to enable the Follow Button on their blog.

Step #1: Install Subscribe2

First thing first. The first thing you will have to do is to install the WordPress plugin that will enable your users to subscribe, and to manage their subscriptions, to your blog via emails. We are using the really good Subscribe2 WordPress Plugin that gives these features to your WordPress instance.

To install this plugin using WordPress’ automatic plugin installation system, follow these instructions. Read the plugin’s installation instruction if you want to do this the manual way:

  1. Log in to your WordPress blog and visit Plugins->Add New.
  2. Search for Subscribe2, click “Install Now” and then Activate the Plugin
  3. Click the “Settings” admin menu link, and select “Subscribe2”
  4. Configure the options to taste, including the email template and any categories which should be excluded from notification
  5. Click the “Tools” admin menu link, and select “Subscribers”
  6. Manually subscribe people as you see fit
  7. Create a WordPress Page to display the subscription form. When creating the page, you may click the “S2” button on the QuickBar to automatically insert the subscribe2 token. Or, if you prefer, you may manually insert the subscribe2 shortcode or token: [raw][subscribe2][/raw] or the HTML invisible Ensure the token is on a line by itself and that it has a blank line above and below. This token will automatically be replaced by dynamic subscription information and will display all forms and messages as necessary
  8. In the WordPress “Settings” area for Subscribe2 select the page name in the “Appearance” section that of the WordPress page created in step 7

On this blog, I called the page created at step #7: Follow. Once you are done installing the plugin, you can test it by visiting your Follow page and by entering your own email (one that is not attached to any user of your account is preferable) and by checking in your inbox if you receive a subscription notification. If you haven’t, you may want to take a look at this FAQ to debug any possible issue with your outgoing email service.

Step #2: Customize your Follow Page

This next step is optional. Since that the form generated by the Subscribe2 plugin is really minimalist, you may want to customize it a little bit, to change its design and to add some explanation in the page, to help your readers to understand what is going on. Take a look at my own Follow page to see what I did to customize that page.

Step #3: Add the Follow Button code in you theme

The third step is really what will morph the Subscribe2 plugin into the Follow Button. What we are doing here, is just to add the code, in your theme, to display the Follow Button.

The first thing you have to do, is to locate where the footer of the pages is generated in the theme. Open the theme folder of your blog: /../wordpress/wp-content/themes/mytheme/. Then you will have to open a few files to check where the </body> ending HTML tag is generated. The file where that code is generated really depends on how the theme got designed. You can do a search, within all the PHP files in that folder for the string “</body>“. This should give you the answer right away. Once you located that place, you are good to continue with the following instructions.

Important note: It is possible that your Theme doesn’t use jQuery by default. If it is the case, then you have to edit the header.php (or whatever the name of the file where the header of your blog is generated) of your theme, and add the following line in the <head>...</head> section of the page:

[cc lang=’html4strict’ line_numbers=’true’]

[raw][/raw]

[/cc]

If you don’t have jQuery loaded, a JavaScript error will be returned, and the panel will “freeze” in the webpage. Once you make sure that jQuery was loaded, do proceed with this code:

[cc lang=’html4strict’ line_numbers=’true’]
[raw]

Follow

Get every new post on this blog delivered to your Inbox.

Join get_var(“SELECT COUNT(id) FROM wp_subscribe2 WHERE active=’1′”); ?> other followers:

Or subscribe to the RSS feed by clicking on the counter:

[[ADD-YOUR-RSS-FEED-LINK-HERE]]

[/raw]
[/cc]

The only thing you have to do is to copy/paste that code above the </body> tag. Then, do the following three modifications to properly wire it in your blog:

  • At line #41, replace [[PATH-TO-THE-FAMFAM-ICON]]with the path of the asterisk_orange.png icon, on your blog
  • At line #211, replace [[PATH-TO-YOUR-FOLLOW-WORDPRESS-PAGE]] by the URL of your Follow page (the one you created when you installed Subscribe2)
  • At line #228, replace [[ADD-YOUR-RSS-FEED-LINK-HERE]] by the link to your RSS feed

You can get the free asterisk_orange.png icon image from the FamFamFam website. The only thing you have to do, is to download that image, and to put it in the folder you defined for [[PATH-TO-THE-FAMFAM-ICON]]. However, you can use whatever image that you prefer, that may better fit the design of your blog.

Step #4: Disable it For Mobile Devices

Some mobile devices may have issues displaying this floating window. Sometimes, the window may be floating in the middle of the device’s screen without folding-back in the bottom of the page. For this reason, you may want to disable (remove) this option if the user is using a mobile device to read your blog. You can easily disable it if the web server detects that a mobile devise is requesting the webpage by adding these two blocks of code.

First, copy and paste this first block of code above the code of the Follow button (before line #1):

[cc lang=’php’ line_numbers=’true’]
[raw]

[/raw]
[/cc]

Then copy and paste this second block of code below the code of the follow button (after line #231):

[cc lang=’php’ line_numbers=’true’]
[raw]

[/raw]
[/cc]

This code come from the Detect Mobile Browser project and is the best mobile device detection code I saw so far. What this code does, is not to include the Follow Button if the device that is requesting the webpage is a mobile device. Otherwise, the Follow Button is added to the HTML page.

Step #5: Test it!

If you are reading this step #5, it means that you finished to create your own, self-hosted, Follow Button!

Congratulation!

But the last thing that remains to be done, is to test it. Once you saved your file with the code above, just refresh any page of your blog. You should see appearing the Follow button on the bottom-right corner of your blog. If you click on it, you should see the form that let your readers subscribing to the system. If you add one of your emails, and click the subscribe button, you should get redirected to the Follow page. Finally you should receive a confirmation email that ask you to confirm your subscription by clicking on a link.

If all these steps properly works, it means that you are done and ready to provide that new functionality to the readers of your blog!

Conclusion

Even if this blog post is few pages long, I hope you found it easy to install and setup. If you have any question regarding this hack, don’t hesitate to ask them down there, in the comments section of this post. I will be happy to answer all of them.

Happy Hacking!

 

Translations

This blog post as been translated in Federico Bozo in Spanish. Other translations will be added to this section.

124 thoughts on “WordPress’s Follow Button for Non-WordPress.com Users

  1. This is cool! (Was looking for whatever plugin WP used on the demo site)

    What I need is something that sends out notification if a page has been updated as well as doe a new post.

    By chance does this send notification for page updates?

    Many thanks,

    kp

  2. Hi!

    Yes you can send notifications for pages, but I can’t see an option in Subscribe2 to do send an email for updated pages. In any case, I think it would be pretty easy to add this functionality to that plugin, for your own needs.

    So, to resume: you can send emails for *new* pages and posts; but apparently not for updated ones.

    Thanks

    Fred

  3. Hi Frederick, can I use the Feedburner subscription instead of the Subscribe2 Plugin?

  4. Hi Renji!

    So, what you want is only the feedburner link that I have on my blog, without caring about the email subscriptions right?

    If so, then you can certainly do this. What you will have to do is to skip the Step #1 and Step #2. In Step #3 you will have to remove everything between the lines 209 to 229, and you will have to put your Feedburner chicklet in there.

    Should be as simple as this.

    Tell me if it works!

    Take care,

    Fred

  5. Hi Fred,

    Sorry for not being clear.

    I mean, can I use the Feedburner email subscription form instead? If I replace the lines from 211 to 223, with the form code that Feedburner provides, will it work? Right now, I have that form in my blog’s sidebar. So if this would work, I would like to remove it.

    Thanks.

  6. Hi Renji,

    Sure it should. Just copy your current Form’s HTML and replace what is between lines 209 to 229 by it, and don’t bother with Step #1 and Step #2.

    Tell me if it works,

    Thanks,

    Fred

  7. Thank you very much for this guide.

    It allowed me to add into a new ‘non WordPress’ website with minor modifications, hope you don’t mind?

    Needed to add jQuery 1.6 as site is still running 1.3.2 so ‘slide’ effect didn’t initially work.

    Can see it in action here:
    http://spanishvilla.businesswebsitemanager.com/_blog/Spanish_Property_News

  8. Hi Vincent!

    That looks great and clean! Yeah, you have a good point regarding JQuery, users have to make sure to load the latest version on their blog (but this really depends on their theme I think).

    Thanks for your inputs!

    Take care,

    Fred

  9. Dear Fred,

    You are A M A Z I N G, thank you for creating this for us to use. I am beyond happy with the ability to have the “Follow” button on my blog now. Seriously, I am jumping for joy. xoxoxox

    Check it out if you’d like: http://fashionintel.com/

    Best Wishes,
    Natalie

  10. Grrrr, I spoke too soon. Womp.
    Was hoping you could help me trouble shoot something. My follow button looks great when you click on it, but it doesn’t actually subscribe the reader when they enter their email address. It doesn’t do anything and I’m not sure why. I linked it to this page I specifically created: http://fashionintel.com/follow/ in the code, but even when you try to subscribe on that page, it doesn’t work.

    Do you have any insight you could share please. Would love your help!

    Best Wishes,
    Natalie

  11. Hi Natalie!

    Glad you like it 🙂 I took a quick look at your blog, and you seems to be missing a few things from what I put in this blog post. Take a look at the HTML code you put on your blog, and check the difference. Take a particular look at the <input /> elements which are not good. The input elements is what send the information to the S2 WordPress plugin. So, what you have to do is to re-use the *exact* HTML code from this blogpost, and to change the text if needed. Also make sure that the S2 plugin is properly working first.

    Tell me if you hit any other bumps down the road 🙂

    Take care,

    Fred

  12. Hello Fred,

    Thanks for the reply, I sincerely appreciate it! What you had looked at on my page was the RSS subscribe and not the wp subscribe, I was trying to go the angle of your other followers by replacing 209 to 229.

    BUT, I’ve gone back to square one and it still doesn’t work for me. I copied all of the code here, pasted it exactly in my footer, just changed the “ADD YOUR LINK HERE” parts. I have Subscribed2 activated an everything. YET, when I enter an email address into the box, it still does the exact same thing. Why is it not prompting a new window. I created the page http://fashionintel.com/follow/ for it to refer to and nothing.

    Would love any advice to help figure this out.

    Best Wishes,
    Natalie

  13. Hi Natalie!

    Good, so you definitely fixed a few things. The code is all there now. However, the problem is that the user get redirected to this page:

    http://fashionintel.com/?s=&email=abc&ip=abc&subscribe=Sign me up!

    instead of this one:

    http://fashionintel.com/follow/

    If I try to subscribe using the second link, everything works perfectly. However, the redirection between the Follow popup and that follow page is problematic.

    The code seems good, and Subscribe2 is working properly. I suspect that you may have some issues with some plugin or settings that change the requested URL. Here I am talking about some Apache2 web server settings for the mod_rewrite module. Maybe some “pretty URL” settings in wordpress, some .htaccess files on your server or some other plugin that acts on the URL.

    It may be something else, but this would be the next thing I would investigate.

    Thanks,

    Fred

  14. Dear Fred,

    Thanks for the update, I appreciate the help and support. Everything you just mentioned is unfortunately beyond my computer knowledge. Hopefully I can find someone to help me out on this and I can get it up and running!

    Best Wishes,
    Natalie

  15. Hi Natalie,

    I think I found your problem. Re-open your theme’s page where you put the Follow button. I think you created an error when editing that file.

    Check somewhere around here:

    =====
    <form method=”get” id=”searchform” action=”http://fashionintel.com/”>
    <div><input type=”text” size=”18″ value=”” name=”s” id=”s” />
    <input type=”submit” id=”searchsubmit” value=”Search” class=”btn”</>
    <BR><BR>
    =====

    When you copy/paste the code, you apparently cut some of your page. The search’s form element is not closed, and the input element neither. So what happens is that there is some conflict between the Follow Button’s form and the search’s. Go back to square #1 (I hope you saved the file before starting these modifications) and make sure that you don’t modify any existing code in your page. Then you should be good to go 🙂

    Thanks,

    Fred

  16. Dear Fred,

    You were TOTALLY RIGHT! I removed the other coding from the theme and entered yours and it completely worked. 🙂 Now I’ve gone ahead and replaced the wordpress subscriber option with an RSS email subscribe option as I think that might generate more readers. What are your thoughts on that btw?

    Thanks again for your time and effort. You’re a rad guy!

    xoxo
    NJ

  17. Hi Natalie!

    Great! I confirm that it is not properly working. I like the Feedburner integration as well. This is a nice tweak.

    I think you are good to go now 🙂

    Take care,

    Fred

  18. Hi Everybody,

    I just found that this Follow Button may be causing display issues on some mobile devices. So I added a new step (the new Step #4 in this blog post) that is used to hide the Follow Button if the user that request the webpage is a mobile device.

    So, if you already installed this code, I would suggest you to apply the new Step #4 to your installation so that the Follow Button doesn’t diminish the quality of the experience of your readers.

    Take care,

    Fred

  19. Hi Fred,

    I’ve installed Subscriber2 and I’ve created a page called “Follow”. Currently there is a “Follow” menu item in my sidebar and the link works properly. When I try to implement your button solution, I cannot get any response from the Follow button even though I’ve tried every variation of a URL path that I can think of.

  20. I suspect that my theme, which is old, isn’t compatible with this type of function.

  21. Hi France!

    Ok, if I take a look at your blog, I can see that you are not using the “clean URL” option. So, the pages and blog posts that are available on your blog looks like:

    http://surrealstructures.com/blog/?p=952

    So, at the step that you create a new WordPress page, it will create a page, with a unique ID. Theorically, how you will access that new page is with the URL that looks like:

    http://surrealstructures.com/blog/?p=REPLACE-FOLLOW-PAGE-ID

    That should be the URL of your follow page. Check in your admin dashboard section to find the ID of that page.

    Hope it helps!

    Take care,

    Fred

  22. Hi Fred,

    I have changed my theme to “twenty-eleven”, which I presume is an up-to-date theme. I have changed the permalink settings so that my follow page url is “http://surrealstructures.com/blog/follow/” and I’ve put the code snippets into the footer.php (with the proper URLs).

    I’m still not having any luck. The panel that is supposed to be animated is just stuck half-showing, and the Test (Follow) button is unresponsive. Am I missing some java script code? Or having I put your code in the wrong place?

    Thanks. 🙂

  23. Hi!

    Yes, jQuery is missing. In the header.php (or whatever the name of the file where the header of your blog is generated) of your theme, add the following line in the <head>…</head> section of the page:

    <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js” type=”text/javascript”></script>

    Then retry.

    Thanks,

    Fred

  24. Thanks Fred. That was it! 🙂

  25. I forgot to say thanks for the work you did on this. 🙂

  26. Frances: no problem, my pleasure 🙂

  27. WordPress.org ähnlicher Folgen Popup | ITsolution² Entwicklungswebseite
  28. Hi Federick,

    splendid instructions. In my local test environment it works like a charm.
    I have a question, though. In theory, it should be possible to link the “subscribe” button to the subscription module of WordPress’ Jetpack, rather than to Subscribe2, right?
    If I am right: Which part of the code you give above defines what subscription module is used?

    Thanks

  29. Hi Uwe!

    Good to see its works properly!

    About the JetPack: is their Subscribe option Subscriber2? If so, I would say it should works; otherwise some testing will be needed. I have no idea if it works the same way or not since I never tested it.

    If you have time to check, and if it works, do post the conclusion on this blog post 🙂

    Thanks!

    Take care,

    Fred

  30. Hey Fred,

    no, Jetpack doesn’t work with Subscriber2 as their email subscription module. Instead, you get the same as you would with a wordpress.com email subscription. There is no additional page. You, the reader, manage your subscriptions through WordPress.

    On my second blog – http://www.nevermindthebuzzkills.com/ – I have the Jetpack email subscription activated (right sidebar).

    I’ll try to poke a stick at the code, but since I don’t know what piece of your code refers to the subscription module I doubt I can get it to work. That’s why I was asking. I’ll try. But chances are that I replace the wrong piece, cut out too much or not enough.

  31. Hi!

    Hoo ok. So, it should work. Try using that “subscription” code from you blog, and replace what is between lines #211 to #223 above. (So, basically to switch the forms from the subscription2 to the one of the Jetpack).

    Personally I prefer S2 because I don’t need to link my blog to any wordpress.com account. But this is just a mater of taste; it should certainly work.

    Thanks,

    Fred

  32. Hey Fred,

    I’m a happy camper. That was exactly the hint I needed. Replacing the piece of code you mentioned with the equivalent from the Jetpack module, some light tweaking of that code to make things look better and now it is live and working.

    The only thing still bothering me is that it also shows up on the start page of the site (the rest of the footer is suppressed there, but this code comes after the footer container so it is still displayed).
    A little more experimenting should take care of that. Hopefully.

    And you are right, it’s a matter of taste. I use Jetpack anyways and prefer to have an email subscription without an additional form page. Also, the emails wordpress sends look nice enough.

    Thanks a bunch. I’ll even consider implementing this in my music blog as well.

  33. Hi Fred.

    Thanks for posting this information.

    However I wasn’t able to make it work.

    I used Thesis 1.8.2 (not sure if you’ve heard that) so I kind of chopping your codes.

    I separate the CSS, jQuery and the PHP files but nothing will show up.

    I try pasting the whole code in Thesis Open Hooks in Footer area. It seems fine, but the problem is it will only work in Post. It will show nothing in the Page. Even The word Follow cant be Seen in page. Only in post.

    Any help would be much appreciated.

    Cheers,
    Kenn

  34. Thank you!
    It is wonderful and very helpful. I’m newbie in php and javascript but I can make this follow button and another button (like you “Resources”) for my site!

  35. Hi Uwe!

    Great to see that it is now working on your side, the way you wanted it! 🙂

    About your “problem”, it is really a matter of where you put it in your Theme, and how. There should be a way to display it in some of your blog section only. (and on the main page for example).

    My pleasure!

  36. Hi Ken!

    Sorry to hear that. Unfortunately I have no idea what this is, so I will be of little help I fear 🙁

    It is sure that if this thing is playing with the code, and doesn’t play nice with it, you may endup with some issues. To fix that, some debugging would be warranted I think.

    Good luck!

  37. Hey Fred,

    found the solution to hide it on the start page through a style.css exception definition, same way I did with header, footer, menu etc on the start page.
    And by now I can confirm that it is working beautifully in connection with Jetpack. Emails are coming in (or going out, depending on how you see it).

    Thanks again

  38. Hi Uwe!

    Yup, I can see it now, well done Sir!

    I guess that they will eventually add it to the JetPack directly, but in mean time, this is quite useful!

    Take care,

    Fred

  39. Hi Fred,
    Can we get it to ‘pop-up’ after X seconds like the survey thingy on this page?
    http://headwaythemes.com/pricing/

  40. Hi Frederick,

    I installed the code and customized it. It worked well when testing, and now it freezes. Can you see my site and see what has gone wrong?

    http://yeahthatskosher.com

    Thanks.

  41. Hi Fred

    Thanks for all your helpful hard work. I’m an near total newbie at blogging, at WordPress, and at RSS, so perhaps this is just too ambitious for me. I’ve tried to follow the instructions exactly but it’s not working.

    I don’t want to waste your time but wondered if you can anything obviously wrong about what I’ve done?

    Anyway, season’s greetings!

  42. Hi Dani,

    The page is still loading after 3 minutes (seems that multiple things comes from various external sites that are not really responsive, like images, etc.)

    I yet doesn’t see the button. But in any case, most of the time, the reason for that to happen is that there are other JavaScript errors that stops the execution of the script (and so, the “freeze”). I would suggest you to check for javascript errors, and see if it is not another module that interact with it and make it freeze. Right now, it doesn’t seem to be enabled.

    Thanks!

    Take care,

    Fred

  43. Hi Fred,
    What would we need to change to make the ‘button’ appear and slide from either the top or side?

    Could be a useful follow-up to this 😉

  44. Hi Geoff!

    You are, I think, experiencing the same issue as Dani. So, in your case, the problem is that you theme is not loading jQuery by default. So, what you have to do is to load jQuery, in your theme. Check the Step #3, I updated it with an Important Note. Just follow what is there and it should resolve your issue.

    Dani: same for you.

    Hope it resolves your issues!

  45. Vincent: it would need some tweaks to the code. Considering all the works I have to do on the Open Semantic Framework, I leaves this as an exercise to the readers 😀

    If anyone come-up with something regarding this, then I will add to this blog post.

    Thanks!

  46. Hi Frederick,

    Thank you following up.

    I added the jquery tag, and it didnt make a difference.

    The Follow tab worked originally, but after I added subscribers, it continues to show up, but doesnt actually pop up.

    Here is a screenshot: http://yeahthatskosher.com/wp-content/uploads/2011/12/Screen-Shot-2011-12-23-at-12.02.03-PM.png

    Unsure how to fix this.

    Thanks.

    ~Dani

  47. Hi Dani,

    What I see is a javascript error:

    “jQuery(…).dialog is not a function”

    at line 38.

    Because of this error, jQuery stops its execution, and so the reason why the thing is not working. Check the code around that place. I think this is some customization you did, and there are some execution errors with it.

    Hope it helps!

    Thanks,

    Fred

  48. Hi Frederick,

    My wife is a photographer and she wanted the follow button but couldn’t make it work. We followed your instructions and it now works perfect!!! We changed the asterisk for a camera and took off the rss feed option. Thank you very much for you instructions.
    You are welcome to visit (http://severine-photography.com/) and provide any feedback.

    Thanks,

    Jorge & Severine

  49. Hi Frederick,

    I actually removed all the code, and inserted your code back with no customizations, and I’m still seeing the same error.

    What’s ironic is that when I first installed it, it worked last week, but something happened, and now I get what you see on my site now:

    http://yeahthatskosher.com

    Why would it initially work, and now cease to work?

  50. Hi Frederick!
    Thank you for this article.
    I’ve translated your article to spanish and made a few changes.
    A friend of mine wanted to make this change and your solution was the only one I really liked.
    Basically my friend wanted to have the closest to the real thing so I didn’t add the RSS feed and replaced the icon with a plus made by me.

    You can check my article http://corchoweb.com/2011/soluciones/el-follow-buttonde-wordpress-para-usuarios-no-wordpress-com/
    and I say clearly that is YOUR article with a few tweaks.

    Thank you and my best wishes to you.

Leave a Reply

Your email address will not be published. Required fields are marked *