Hosting Tutorial & Guide

5 Ways to Integrate Twitter with WordPress to Drive Engagement

updated on Mar 01, 2016
5 Ways to Integrate Twitter with WordPress to Drive Engagement Twitter and WordPress are both powerful tools. The former is one of the largest social networking platforms with over 300 million active users, and the latter is the most popular CMS used for blogging.

Since you are trying to get more attention, traffic or sales, bringing the power of Twitter and WordPress together will be helpful. Twitter drives traffic to your WordPress site, and at the same time, you can invite your site visitors to follow you and interact with you on Twitter.

Depending on what you want to achieve, there are multiple ways you can use to integrate Twitter with WordPress. In below, we will introduce several easy ways that are effective in taking your online presence to the next level.

1. Embed Tweets in WordPress Posts

The good support for Twitter built in WordPress allows you to add a single tweet in a post or page easily and quickly without touching any code or plugin. What you have to do is only to find the specific tweet that you want to embed, copy the URL of it, and then paste the URL anywhere in the post editor. WordPress deals with all the rest tasks. Note that the URL should be placed in its own line if you are using the text mode.

When a tweet is embedded into a post in this way, it still comes with the Twitter functionalities including the reply, retweet and favorite buttons, the avatar, the follow button, and the timestamp.

Embed a Tweet in WordPress Post

Manually embedding tweets in posts is simple, but the limitation is that you can only embed one tweet at a time. If you want to show more tweets, you will have to paste all of them one by one, which is frustrating. However, there are better solutions for displaying multiple tweets which will be detailed later.

2. Add a Twitter Follow Button to Your WordPress Site

Displaying a Twitter follow button on your WordPress site, you are making it easy for your website visitors to follow and connect with you on Twitter. With such a button, the visitors can follow your Twitter account with one click without leaving the page they are reading.

Twitter offers a simple embed code generator for the follow button. There are several options available in the generator, and you can get a live preview immediately as you change the options. Below the preview, you can see a code block which includes the embed code.

Twitter Follow Button Generator

Now you can copy the embed code and paste it anywhere you want in the WordPress theme. For example, if you would like to display the follow button in the sidebar, then you need to put the code into the sidebar.php file before the closing tag. Alternatively, you can add a text widget to the sidebar and paste the embed code in it.

Also, you can add the follow button in the header or footer section by editing the corresponding theme files (header.php or footer.php). But no matter where you want the button to show, make sure that it is visible "globally" on your site so that all visitors can see it.

If you are unfamiliar with editing the theme files, we'd suggest you back up your WordPress site or the particular theme files before making any modification.

3. Add a Tweet Button to Your Posts

The Tweet button offered by Twitter is also a great tool as it enables your visitors to spread your words easily by sharing your content to their Twitter accounts. It is now widely used on all types of websites ranging from personal blogs to large business sites.

Being similar to the follow button, the Tweet button can also be added to your WordPress site easily as Twitter offers an easy-to-use Tweet button generator. You can customize the URL, tweet text, hashtag and more as you like.

Twitter Tweet Button Generator

After copying the embed code of the Tweet button from the generator, you can paste it in single.php, index.php, category.php, page.php and more. Where you add the code to determines the visitors to which parts of your WordPress site can see the button. We would recommend adding the embed code to the single.php file of your current theme so that all your posts are shareable.

Adding the Twitter Tweet button is a simple task to deal with. Besides the manual method, you can also use a WordPress Twitter plugin to do this. However, we don't suggest plugins unless you are really uncomfortable with any code, because plugins always slow down the page loads.

4. Auto-Tweet the New Posts on Your WordPress Site

Auto-tweeting your blog posts when they are published is a good way to let your regular followers know about your updates. This is also time-saving because you don't have to create a new tweet every time you want to share a post on Twitter.

There are several ways available for setting up auto-tweeting. You can use the Twitter Feed, install a plugin like WP to Twitter, or take advantage of some automation tools like Buffer and IFTTT. Among all the three options, we recommend the last one most because such tools enable you to connect your WordPress site with Twitter as well as dozens of other social networks with the least effort.

For this tutorial, we will explain how to use IFTTT, an easy-to-use and free service, to auto-tweet your WordPress posts. First of all, you need to visit IFTTT website and create a free account with an email address. Once you are logged in, follow the steps below.

Step 1: Connect your WordPress site and Twitter account to IFTTT

When you locate in the dashboard of IFTTT, click on "Channels" in the top menu. You will have to create two Channels for your WordPress site and Twitter account.

IFTTT Channels

In the available Channels, find WordPress, and then enter the blog URL, admin username and password to get your WordPress site connected to IFTTT. When the connection is established, you will be able to access the blog settings, notifications and admin profile directly from IFTTT.

Connect WordPress

Now go back to the Channels and find Twitter. To connect your Twitter account, you have to authorize IFTTT the access to your account. The authorization will allow IFTTT to read tweets, see your followers, update your profile and post new tweets. If you have already signed in a Twitter account, the authentication will happen automatically. No extra step is needed.

Connect Twitter

Step 2: Create a WordPress to Twitter Recipe

A good thing of using IFTTT is that it allows you to use the existing recipes published by other users. Just search "WordPress to Twitter" in the search box on the top of the screen, and you can find more than one hundred recipes ready for use.

WordPress to Twitter Recipes

If you don't want to bother creating a new recipe, you can browse through the available recipes with the most users and check their details. Once you find one that meets your needs, you can click on the big "Add" button on the details page to use the recipe. Your WordPress and Twitter Channels will be included in the recipe automatically.

Run the WordPress to Twitter Recipe

As "WordPress to Twitter" is a popular recipe used by a large number of bloggers, you should rest assured that there would be no problem with the recipe you use even if you have not created it by yourself.

In the case that you want to create a custom recipe from the ground up, you can follow this tutorial.

5. Show the Recent Tweets on Your WordPress Site

If you tweet interesting things or useful content regularly, then displaying the recent tweets on your WordPress site can increase your Twitter followers and get your visitors staying longer. In the case that you are managing to do this, the Twitter user widget could be the easiest way. We will recommend it prior to any plugin.

The entire process is easy, and you can follow the steps below to get a widget created.
  1. Visit the Twitter Widgets page and sign in Twitter with an account.
  2. The default location would be under the "User timeline" tab. Stay where you are, and customize the height, theme and link color as you like. The width is adjusted automatically.
  3. Preview the widget.
  4. Click on "Create widget" when there is no problem.
Create a Twitter User Widget

When the widget is created, you can get a widget code under the preview of the widget. Copy this code.

Copy the Widget Code

Depending on where you want the recent tweets to display, you can add the widget code directly in the content of any page or post, or use it in a text widget in the sidebar.

If you want to show the recent tweets in the sidebar of your WordPress site, which is common among blogs, you just need to drag a text widget to the sidebar and then paste the widget code in the content.

Add the Widget Code in a Text Widget

Now preview your site to see the recent tweets widget in the sidebar.

Show Recent Tweets in WordPress Sidebar