Twitter is one of the leading social networks in the world used by millions of people. Like with most social network such as Facebook and LinkedIn, it has a range of social features such as:
- Sign in with Twitter which when incorporated to a website, users would be able to log in using their Twitter account.
- Embedded Timelines that syndicates your Twitter timeline to your website.
- Follow button, Tweet button and Embedded Tweets.
A number of WordPress themes ship with a feature that displays list of recent tweets made by a user without using the Embedded Timelines widget.
This is achievable programmatically by querying the Twitter API for the recent tweets.
If you happen to use one of such themes, you are asked to provide the following information in order to get the feature working:
- Consumer Key (API Key)
- Consumer Secret (API Secret)
- Access Token
- Access Token Secret
In this tutorial, I will walk us through the steps in creating a Twitter application in order to get your keys and access tokens.
Creating a Twitter Application
Login to Twitter developer center using your Twitter account and navigate to the Application Management console.
Click on the Create New App button to initiate the Twitter application creation.
Fill the form and click the submit button to create the application.
Below are the form fields and their description.
Name: This field will be the display name of your application and will be used during user authentication.
Description: a short description about your website or application.
Website: Enter the full URL (including http://) of your website.
Callback URL: If you intend to return your users to a specific URL after authentication, specify it here.
In basic cases like WordPress recent tweets widget found in themes, this field can be left blank.
Read and agree to the Developer Agreement. Finally, hit the create button.
You’re now done creating your application.
Getting the Application Keys and Tokens
To get your application consumer key and secret, navigate to the API Keys tab.
The API keys and API secret is also referred to as the consumer key and consumer secret, respectively.
To get the application access token and access token secrets, still at the API Keys tab, scroll downward and click on the
Create my access token button.
Refresh the page and your application Access tokens will be shown to you.
Copy the application details and enter them into your WordPress theme’s Twitter settings and you should be good to go.