How to Easily Add a Twitter “Follow” Button to Your Blog

Recently I decided to go through my site and look for things that I felt it was missing. I noticed was that I lacked a one-click process to allow folks to follow me on Twitter.

I used to have a Twitter link in my sidebar, and plan to leave it there – but I strategically identified a location I thought might be a good place for the Twitter “Follow” button.

Here’s a screenshot:

Twitter Follow Button

I’m not sure if this will distract folks from signing up for my newsletter, but there’s only one way to find out. I don’t see anything wrong with experimenting, right?

I’ve promised you that I’d share things that I do here on my website. It only makes sense to explain how I do the things I do, so that you can benefit as well.

I searched how to add a Twitter “Follow” button and found that this was extremely easy to do. Thankfully Twitter has such great documentation for developers.

If you’re geeky and want to check out the comprehensive explanation (and parameters) you can header over the developer page on adding a “Follow” button.

Below is the code you can use to display various “Follow” buttons. Obviously you’ll want to replace the bgardner mentions with your own Twitter username.

Large button, with follower count


Large button, no follower count


Medium button, with follower count


Medium button, no follower count


Email Newsletter

Like what you read here in this blog post?
Get more like it delivered to your inbox daily.

Comments

  1. says

    One place we have added the Twitter follow button on a few sites that seems to work well is the Author Bio Title. I add the same code above wrapped in a class so it can be floated right in the main stylesheet.

  2. says

    Been looking for an easy tutorial on this as I have lots of twitter followers and heard it’s a good idea to display the count if you do.

    Thanks Brian

  3. says

    Thanks for the post Brian. This is a great idea and thanks for making it so simple and straight forward. I like how you thought about your site and what was missing and rectified this. I love the idea of on-click processes and feel it makes a site so much more streamline and user friendly.

  4. Daniel says

    Brian

    As ever a relevant post. I have placed the script in a html box in my primary side bar.

    I wondered if anyone had thought of flipping it 90 degrees anti-clockwise and placing it on the far right of the last side bar (where your background image is) .
    I have used Genesis Footer for this sort of thing However, I guess we going to need additional script to get the correct positioning on the screen.

  5. says

    Am I the only one having problems with this. When pasting the code into the enews and updates widget it strips the javascript code and will not render. I’ve been fussing with this for two days now, surely it’s something simple I’m missing. See here for example. Thanks Brian.

    P.S. If this needs to go in an external php file, can you elaborate on that a tad…

    -Ben

      • says

        Brian I appreciate your responses, but the tutorial you linked to does not cover how to create an external php file for this and link to it. I’m tearing my hair out trying to figure this out. I know how to create an external file, but if you’re placing the php code that registers the widget area in that file and the hook, how do you call to that file from the WP widget area or post area?

        Is this done like a php include? I tried that but can’t use php in a widget to call to the external file. Greatly appreciated if you could clarify?

    • says

      Ben, I’ve just come across this problem and you can paste the javascript bit into the Genesis header or footer code boxes under ‘Theme Settings’. The next problem is that the enews widget, or perhaps just widgets generally, strip out the ‘data-size’ and other format options. Still, it works.

  6. Geemox says

    Hi Brian,

    Thanks for the great article. Recently I tried to add the twitter follow button to my website. But when I pasted the code inside the div tag where I wanted the button, it only showed plain text( follow@xxxxx), not the button. When I clicked on it it took me to my twitter profile.
    Can you please tell me why this happens.

    Thanks for your time.

      • Jacob says

        Hi Brian. I have the same problem, like Geemox says, it only showed plain text, whitout the button and when you click on it, doesn´t open the follow window, it takes you to the twitter profile.

        I think it could be a twitter code problem that they haven´t see yet.

        example: [IMG]http://i1052.photobucket.com/albums/s445/G_Bracho/b33ccaa5.png[/IMG]

    • says

      Not that I know of, as this is code that is made available through Twitter. They are pretty rigid when it comes to modifying anything they provide, as I’m sure they want to maintain a consistent approach to the code/tools they all us to show.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>