Family Encyclopedia >> Electronics

How to Add Twitter Anywhere in WordPress

Twitter launched its @anywhere platform not too long ago. This new platform integrates twitter into your site with a few lines of JavaScript. It allows more tweets, more traffic, more follows, more interaction, more users and more information. You can now embed a tweet box on your site where people can tweet directly from your site. It also converts all Twitter usernames to a link (@wpbeginner). If you enable the hovercard option, users will see a hover box with a follow button and user information. You can also create connect with twitter buttons, follow @wpbeginner on twitter buttons and much more. We believe this new platform will play an important role in the future of the web as Twitter grows. In this article, we'll share how you can add some Twitter Anywhere platform elements to your WordPress blog.

Update:Twitter is disabling the @anywhere API on December 6, 2012. Here are more details.

Step 1:Register an API

Before you can add the platform anywhere on your site, you need to register an API. You will be taken to a page that will look like this:

How to Add Twitter Anywhere in WordPress

Once you sign up, you should receive an API key. The next thing to make sure is that the permission level is set to Read and Write, otherwise users would not be able to click the Follow button. This is a technical issue with Twitter, but they are working to fix it. But to keep us safe, we'll provide instructions on how to do this.

First click on the link On this page, you will see the application that was registered. Click on the app name and you should be taken to the app details page. There is a button called "Edit Application Settings". Click this button to go to the editing page where you will need to scroll down to the item labeled "Default Access Type". Change this to "Read &Write".

Step 2:Implement it on your site.

Since there are numerous features on the platform anywhere, we will explain each of them one by one. The first thing you need to do is call the main JavaScript. Twitter recommends that you put this script in your header.php file (between these two codes).


Remember to add your API key where it says YourAPIKey in the link.

Now let's look at the individual features that this platform can do for you.

Automatically link all Twitter usernames

This feature will automatically link all Twitter usernames in your posts and comments. If you mention a Twitter username in this format:@wpbeginner <Automatically link all Twitter usernames to a Hovercard

How to Add Twitter Anywhere in WordPress

This feature automatically links all Twitter usernames found on the page, and also provides a hovercard with a mouseover effect. So when your site user hovers over a username like @wpbeginner, they will see a hoverbox as shown in the example above. If they click the Follow button, they can directly follow the user from your website. To enable this feature, simply paste the following code into your site header below the main script.

 twttr.anywhere (onAnywhereLoad); función onAnywhereLoad (twitter) twitter.hovercards (); ; 

Smart buttons to follow on Twitter

How to Add Twitter Anywhere in WordPress

The smart follow button allows your user to follow their account directly from your site. You can create buttons for your site and use them in your post or anywhere else. See the live example below:

To add this type of button to your site, first paste the following code into your site header below the main script:

 twttr.anywhere (onAnywhereLoad); function onAnywhereLoad (twitter) twitter ('# follow-wpbeginner'). followButton ("wpbeginner"); ; 

Second, you need to add the following div tag where you want this button to display:


Remember to change wpbeginner to your username, otherwise it will display a follow link to our twitter account.

Live Tweet Box on your site

You can create a tweet box on your site that will allow users to tweet directly from your site without ever having to go to Twitter. An example of this box can be seen below:(Remember that if you click tweet, it will.).

Try tweeting from the live box above to see how cool it is. We would really appreciate if you tweet the default content, so it helps us How to Add Twitter Anywhere in WordPress

Well, as you can see, this live tweet box is really powerful. You can even add Retweet text in there if you want with slight customization. To add a live tweet box to your site, first paste the following code into your site header after the main script:

 twttr.anywhere (onAnywhereLoad); funcion onAnywhereLoad (twitter) twitter ("# custom-tweetbox"). tweetBox (label: "Live Tweet Box:", defaultContent: "Todo el mundo debería seguir @wpbeginner para obtener consejos impresionantes #WordPress", altura: 50, ancho: 480 ,); ; 

Then add the following code where you want to display the live tweet box:


We see that there are already some plugins in the WordPress plugin directory that allow you to use the basic features, such as the floating card or the automatic link. You can use those plugins if you want, but this is such a simple thing that it's better to place the codes manually.

If you liked this article, please retweet. If we missed something, please let us know in the comments.

Additional resource:

Twitter Anywhere Documentation
Simple Twitter connect plugin (great plugin from a supportive author - Thanks Otto)