WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Tutorials» How to Add the Official Twitter Follow Button in WordPress

How to Add the Official Twitter Follow Button in WordPress

Last updated on January 10th, 2013 by Editorial Staff
69 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Add the Official Twitter Follow Button in WordPress

Twitter is extending its functionalities to the wider world wide web. It all started with the official tweet button, then the Twitter Anywhere Platform , and recently the new official twitter follow button. You are probably wondering what the heck is this twitter follow button? What is different in the Twitter follow button, and the smart follow button? Don’t worry, in this article we will cover what is the twitter follow button, and how you can add it in your WordPress site.

What is the Twitter Follow Button

Twitter follow button is a small widget which allows users to easily follow your twitter account (or any twitter account) from any website. The follow button uses the same implementation model as the official tweet button, and it is really simple to integrate. You can see the demo of the follow button on the top left corner of the image below. When you click on the follow button, a window opens with more information about the user.

Twitter Follow Button

You are probably wondering how it is different from the Smart Follow button below?

Well the smart follow button requires you to do the whole Twitter Anywhere integration. It also doesn’t allow you to show your follower count or do any customization. Whereas the Twitter follow button lets you show the count, and it is very easy to integrate. Check out the live example below (don’t forget to click follow to see what it does):

Follow @wpbeginner

How to Add the Official Twitter Follow Button in WordPress

You can go to the Follow Button page and generate a code for you. Or you can simply copy the code below:

<a href="http://twitter.com/wpbeginner" class="twitter-follow-button" data-show-count="true">Follow @wpbeginner</a>
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>

P.S. Make sure to change the username with your own.

If you are using the official tweet button, then you do not need to paste the script twice. So your code will look like this:

<a href="http://twitter.com/wpbeginner" class="twitter-follow-button" data-show-count="true">Follow @wpbeginner</a>

Now you can paste the code anywhere you like in your WordPress theme. Most folks will put such code in their sidebar.php file. However, if you don’t feel comfortable editing a theme file, then you can utilize WordPress theme widgets as well. All good themes come with widget-ready sidebars. So all you would have to do is go to Appearence » Widgets tab. Then add a text widget to your appropriate sidebar. Lastly, paste the code above, and you are done. Look in the screenshot below for the example:

Twitter Follow Button Widget

There is really no need to add a plugin to do something as simple as this.

Advanced Customization

This section is for designers and developers who want to customize this button further to match their site’s color scheme etc. Twitter lets you customize the button color, text color, link color, language, widget, and alignment of the plugin.

Available variables in the JavaScript version that we are using:

  • data-show-count (true or false)
  • data-button (blue or grey)
  • data-text-color (hex code)
  • data-link-color (hex code)
  • data-lang (en, fr, de, es) – uses the two letter ISO-639-1 language code
  • data-width – (300px)
  • data-align – (right)

If you want to specify it in the a code it would look something like this:

<a href="http://twitter.com/wpbeginner" class="twitter-follow-button" data-button="grey" data-text-color="#FFFFFF" data-link-color="#ffa24f" data-show-count="true">Follow @wpbeginner</a>

Resources:

Follow Button Documentation
Follow Button Generator

69 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • How to Properly Move Your Blog from WordPress.com to WordPress.org

  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

30 Comments

Leave a Reply
  1. Biodun says:
    Jan 17, 2017 at 7:45 am

    Hi,

    I tried to increase the width with the “data-width=300px” option but its not working.

    Reply
  2. Pj Germain says:
    Feb 4, 2016 at 6:29 pm

    SWEET! I didn’t wanna install yet another plug-in and this worked like a champ! I know it’s an old post, but hey, you nailed it!!!

    Thanks a bunch!

    Reply
  3. Verity says:
    Nov 22, 2015 at 5:41 pm

    Hi there, thanks for the info. I’ve added this on to my HTML page but the link is coming up just with text (ie my twitter name) and not the official Twitter button. Any advice? Thanks in advance.

    Reply
  4. Si Sai says:
    Nov 26, 2014 at 6:57 am

    Hi
    what if i have multiple authors on my blog and i want individual authors twitter follow button to be displayed for the posts they have submitted ?

    Reply
  5. Chris Q says:
    Feb 27, 2014 at 4:57 pm

    This is great! Thanks.

    I’ve built my blog from scratch with zero previous knowledge, and resources like yours have proved invaluable along the way.

    I have a question though: is there anyway to hide or remove the counter? It’s half obscured by an image so thought I’d just get rid. I tried deleting what I thought was the obvious piece of code but it’s still there.

    Reply
  6. Nadia says:
    Feb 19, 2014 at 12:05 pm

    I got the button to post just fine and it links and everything but I don’t know how to change the location its in. I posted it in my header but I want the button to show up right next to my FB icon and right now its being half covered up by another picture in the header. Suggestions??

    Reply
    • Nadia says:
      Feb 19, 2014 at 12:23 pm

      Never mind, GOT IT!!! Woot woot

      Reply
      • Nadia says:
        Feb 19, 2014 at 12:25 pm

        For anyone else having this problem-

        I had posted the link provided on this page into my header section. To edit the location, you need to go to the style section. I used this code:

        .twitter-follow-button{
        display:block;
        position:absolute;
        top:60px;
        right:-170px;
        width:32px;
        height:32px;

        Reply
  7. Judy Hochberg says:
    Dec 2, 2013 at 10:53 am

    I installed it in a text widget, and it looks fine on my blog, but I don’t understand how it works. When a user clicks on it, what happens? How does WordPress or Twitter know who the would-be subscriber is?

    When I try clicking on it I get a pop-up message that says something like “You are now subscribed to @my_twitter_handle.” The message is the same whether or not I’m logged into the website. So how is my identity known?

    Reply
  8. Punit Bhalodiya says:
    Oct 10, 2013 at 5:22 am

    nice post for WP-beginners thanks..!!!!!!

    Reply
  9. Pritam Patil says:
    Jul 27, 2013 at 7:40 am

    You are the real wp rockstart man !! its working ..and lets hope i get more followers :)

    Reply
  10. Gemma says:
    Jul 22, 2013 at 11:54 am

    Hi,

    I followed the instructions and it did work–the button appears and when I tested it, it links to my twitter. However, the widget also shows the html code underneath the follow button on my blog. Is there any way to hide the code and just have the button?

    Thanks

    Reply
    • Editorial Staff says:
      Jul 25, 2013 at 7:53 am

      Sounds like a copy/paste error because the widget shouldn’t show any html code.

      Reply
  11. David M. Perkins says:
    Jan 4, 2013 at 12:56 pm

    Okay, unfortunately that didn’t work. Any other place I can go for help?

    Reply
    • Editorial Staff says:
      Jan 5, 2013 at 8:48 am

      Which part didn’t work? What error does it show?

      Reply
      • David M. Perkins says:
        Jan 5, 2013 at 2:55 pm

        The instructions above didn’t help at all–but fortunately I found another way through the plug-ins (after some *hours* I’ll never get back). You have to remember that this is called “WPBeginner”–emphasis on the “Beginner,” and telling someone to post code willy-nilly and not laying out *all* the steps: do this first, then click on that, which will show you this, etc. (some of us “beginners” are complete digital diplodoci, you know), is not helpful.

        In any case, I got it done–but *not* by following the instructions above.

        Reply
        • Editorial Staff says:
          Jan 10, 2013 at 10:52 am

          Hi David,

          The reason why we say paste it anywhere in your theme is because we do not know where you want to add it. It could be in the header, sidebar, footer, after each post etc. Those are all different locations. Furthermore, we did mention that you can go to Appearance » Widgets and add it in the text widget. You can put the text widget in the appropriate widget areas (supported by your theme). Some have widget areas in the footer, but most have it in the sidebar.

        • David M. Perkins says:
          Jan 10, 2013 at 1:30 pm

          @ Editorial Staff said ~

          “The reason why we say paste it anywhere in your theme is because we do not know where you want to add it. It could be in the header, sidebar, footer, after each post etc. Those are all different locations.”

          My point was that the directions could have said: “If you want to put it in your sidebar, go *here,* click on *here,* which will show you *this,* and then you paste the text *there.* If you want to have it appear at the bottom of your post, go *here,* click on *here,* which will show you *this,* etc.” I’ve still got the code, which did not make the button appear, pasted *somewhere* on my dashboard page–but the goddesses only know where it is at the moment.

          Again–some of us *are* beginners here–and digital diplodoci–and beginners sometimes need a gentle, kind, *guiding* hand to get where we want to go, n’est–ce pas?

        • Editorial Staff says:
          Jan 10, 2013 at 8:14 pm

          Hello David,

          While we understand exactly what you are saying, it is harder than it sounds. Each WordPress theme is coded differently (general theme, child themes based on various frameworks etc). On top of that, we can’t possibly cover every single spot a human brain can think of displaying the button. This is the reason why we covered the most basic spot (Appearance > Widgets). Depending on the theme, you will have widgets for your the sidebar, header, footer, etc.

          We have a detailed overview of widgets in our free videos here: http://videos.wpbeginner.com/

  12. eggtartbox says:
    Jan 17, 2012 at 10:05 pm

    I tried it and links to my twitter, but as regular text…would that be because I’m on a wordpress.com blog?

    Reply
    • Alyssa says:
      Jun 27, 2013 at 3:35 pm

      I have the same problem. It links it to my twitter but does not show the button. Any ideas on how to fix this?

      Reply
  13. Gorn says:
    Jul 15, 2011 at 8:45 am

    @wpbeginner Actually, neither. It’s a WordPress faciltiiy hosted by CIX at blog.cix.co.uk.
    I have now got it to work, but by using the “old-style” twitter buttons at http://twitter.com/about/resources/buttons – couldn’t either the “script” form or the shortcode form to work. Any ideas why that is?

    Reply
  14. wpbeginner says:
    Jul 15, 2011 at 7:51 am

    @Gorn Are you doing this on WordPress.com blog or a self-hosted blog?

    Reply
  15. Gorn says:
    Jul 14, 2011 at 7:39 am

    Thanks for this. It doesn’t work for me, though. When I save the Text widget, the script element gets stripped out, and I end up with just a text link in my sidebar. Any ideas?

    Reply
  16. TheNerdyNurse says:
    Jun 20, 2011 at 2:58 am

    nice addition. Feel my site loads too slow as it is. Worried that will be just one more thing to slow it down. I really need to figure out what it causing the drag in loading.

    Reply
  17. jasonfox_me says:
    Jun 16, 2011 at 12:03 pm

    Thanks for the tip. i took the code from Twitter and it it looked good (bad me for not testing) the other day my friend tells me he tried to follow me and got user does not exist. For some reason it left my old handle in the code….just a heads up.

    Reply
  18. TheFadeMusic says:
    Jun 16, 2011 at 12:01 am

    @wpbeginner LUMIX DMC-GF3s http://t.co/8wwbZSR

    Reply
  19. wpbeginner says:
    Jun 15, 2011 at 3:37 pm

    @likewpcom which in most cases would not be necessary.

    Reply
  20. likewpcom says:
    Jun 15, 2011 at 2:41 pm

    Another way to add twitter button is to install a WordPress plugin like http://goo.gl/EHyex

    Reply
  21. AlbertAlbs says:
    Jun 15, 2011 at 2:22 pm

    Yes. I did already. Got too many followers after adding that twitter follow button.

    Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
WP Mail SMTP logo
WP Mail SMTP
Fix WordPress email delivery issues. #1 SMTP plugin. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
LiveChat logo
LiveChat Inc Coupon
Get a 30 day free trial and 30% OFF LiveChat, one of the best live chat service providers for WordPress users.
ConvertKit Coupon Code
ConvertKit Coupon
Get a 14-day no risk FREE trial with this powerful email marketing software.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.