Family Best Time >> Electronics

How to Add Official Twitter Follow Button in WordPress

Twitter is extending its functionalities to the wide 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're probably wondering what the heck this Twitter follow button is. How is the Twitter follow button different from the smart follow button? Don't worry, in this article we'll cover what the Twitter follow button is and how you can add it to your WordPress site.

What is the Twitter Follow button?

The Twitter Follow Button is a small widget that allows users to easily follow their Twitter account (or any Twitter account) from any website. The follow button uses the same implementation model as the official tweet button, and it's really easy to integrate. You can see the Follow button demo in the top left corner of the image below. Clicking the Follow button opens a window with more information about the user.

How to Add Official Twitter Follow Button in WordPress

You're probably wondering how it differs from the smart follow button below?

Well, the smart follow button requires you to do the entire Twitter Anywhere integration. It also does not allow you to display your follower count or do any customization. Whereas the Twitter follow button allows you to display the count, and it's 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 Official Twitter Follow Button in WordPress

You can go to the Follow button page and generate a code for you. Or you can just copy the following code:

Sigue a @wpbeginner 

PS Be sure to change the username to your own.

If you're using the official tweet button, you don't need to paste the script twice. So your code will look like this:

Sigue a @wpbeginner

You can now paste the code anywhere in your WordPress theme. Most people will put that code in their sidebar.php proceedings. However, if you don't feel comfortable editing a theme file, you can also use WordPress theme widgets. All good themes come with widget-ready sidebars. So all you should do is go to Appearance » Widgets tab. Then add a text widget to the corresponding sidebar. Lastly, paste the code above, and you're good to go. Take a look at the screenshot below to see the example:

How to Add Official Twitter Follow Button in WordPress

There's 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 further customize this button to match their site's color scheme, etc. Twitter allows you to customize the button color, text color, link color, language, widget, and plugin alignment.

Variables available in the version of JavaScript we are using:

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

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

 Sigue a @wpbeginner 

Resources:

Follow button documentation
Follow the button generator