Twitter widget

To add this widget, go to Appearance → Widgets on the WordPress menu and drag the widget with the title React – Twitter to your widget area. This widget will display a list of your recent tweets; enter your settings in the fields.

Twitter now requires auth tokens in order to fetch Tweets from their API, this means you will need to create an App on the Twitter Developers website and generate the auth tokens.

1. Go to https://apps.twitter.com and sign in with your Twitter account.

2. Click on Create New App.

3. Give the application a name, description and website. It doesn’t really matter what you enter for these options. Click “Create your Twitter application”.

4. Once the application is created, click on the API Keys tab. On this page you will find the API key and API secret needed for the widget settings.

5. Click on Create my access token, you may need to refresh the page for them to show up. You should now see the last two fields you need to configure the widget – Access token and Access token secret.

6. You will now have all the information you need to configure the Twitter widget within WordPress:

  • API key
  • API secret
  • Access token
  • Access token secret

Alternative method of setting Twitter API keys

If you want to hide the Twitter API keys from the widget settings, or want to set the keys for all React Twitter widgets in a multisite install, you can use PHP constants to set them. Add this code to the React Child theme functions.php file:

1
2
3
4
define('TCW_TWITTER_API_KEY', 'abc123');
define('TCW_TWITTER_API_SECRET', 'abc123');
define('TCW_TWITTER_ACCESS_TOKEN', 'abc123');
define('TCW_TWITTER_ACCESS_TOKEN_SECRET', 'abc123');
define('TCW_TWITTER_API_KEY', 'abc123');
define('TCW_TWITTER_API_SECRET', 'abc123');
define('TCW_TWITTER_ACCESS_TOKEN', 'abc123');
define('TCW_TWITTER_ACCESS_TOKEN_SECRET', 'abc123');

Replace the abc123 parts with the keys as appropriate.

Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy