Bringing Tweets Into Your WordPress Site

Article written by:
  • WordPress
  • Updated: Dec 03, 2013

For reasons that elude most bloggers and content creators, a decidedly large rift has opened between those who maintain standard weblogs and those who frequently contribute to Twitter via a shorter, “microblog” format of writing. This rift has caused virtually every major content management software solution to leave out support for importing tweets into entries, website designs, and back-end control panel interfaces.

WordPress, with 60 million users, is the largest content management platform to exclude Twitter from the conversation in a native way. Luckily, the large and growing community of content creators served by WordPress is also served by an appropriately large and active development community which has made Twitter and a few other major social media integration a priority.

The only downside of this strictly-plugin-based approach to WordPress content aggregation is that the typical user will require several different plugins, and several different approaches, when making sure that their website is satisfactorily integrated with the Twitter service both in the website’s design and within the actual WordPress Dashboard administration interface itself. It can be a tangled web of different WordPress plugins and approaches but, when all is said and done, it’s still better than being completely cut off from one of the world’s most popular and important social networks.

Here’s how to make WordPress and Twitter talk to each other, even if their respective developers have hesitated to do so.

Bringing Tweets to the WordPress Sidebar

The most popular feature request for WordPress, at least as far as Twitter integration is concerned, is the ability to bring standard Twitter tweets into the default WordPress sidebar either using a PHP variable, inclusion code, or a WordPress widget. While the company offers a Twitter widget to users of its remotely-hosted blogging service, it offers no such widget to those customer who simply download the software and install it on their own web server. This is a disappointing setback, but not one which is insurmountable.

First and foremost, a plugin known as “Twitter Widget” on the WordPress Plugins website enables this Twitter widget for all users. However, this is not the same as the standard, WordPress-developed Twitter widget for remotely-hoted weblogs. Instead, this widget is developed by a third-party individual and it looks appropriately “third party.” Instead of using the WordPress API to produce a user-customizable output of Tweets, it merely places the standard Twitter “badge” within a WordPress widget that can be dragged and dropped throughout the sidebar. It’s better than nothing, but it’s not great. It’s perfect for novice users, but those with more advanced skills will appreciate the alternative solution to Twitter integration that follows.

For advanced WordPress designers, a plugin known as WP Twitter Feed is much more adept at producing custom Twitter outputs across templates, in any area where a short code or PHP variable can be inserted into a WordPress template. This is perhaps less immediately convenient than a WordPress widget that can be dragged and dropped within a sidebar, but it’s far more extensible, scalable, and customizable.

Using WP Twitter Feed

Twitter Feed

A little known fact about WordPress theme development is that the use of brackets can actually serve as a variable to insert content into a template if a plugin has enabled this feature. The WP Twitter Feed widget takes advantage of this fact, and a Twitter feed can be placed anywhere into a WordPress template using the following code:

[twitter-feed username=”your-username-here”]


Simply enough, this displays the five most recent tweets by the user whose username lies between the relevant quotation marks. But, because this plugin is designed for more advanced WordPress developers, it can actually be used to display some other content that is popular among Twitter users and WordPress content creators alike. All it requires is a simple modification to the short code insertion tag.

[twitter-feed username=”your-username-here” mode=”mentions”]

This tag will cause WordPress to print every “mention” of a user’s Twitter handle. A mention is typically constructed as @your-username-here and it’s the way Twitter users converse among themselves. Printing mentions of a username, rather than merely printing the latest Tweets that user has written, is a great way to convey importance, authority, and content knowledge to new readers who want to know why an author is qualified to speak on the subject which they are currently writing about.

[twitter-feed mode=”hashtag” hashtag=”Boulders”]

Hashtags are the number one way to get an idea of what’s trending on Twitter at any given moment. Luckily, any hashtag can be shared with site readers by modifying the short code insertion which is placed into WordPress templates. In the example above, every tweet with the hashtag #Boulders will be displayed (up to the five most recent) to site visitors.

< ?php echo do_shortcode(‘[twitter-feed]’); ? >

Of course, no plugin would be complete without a standard PHP variable or template tag method of insertion, and WP Twitter Feed is no exception to this important rule. Those users who want to use the standard PHP method of including plugin content are free to do so, and they can modify the content between the brackets (currently [twitter-feed] in this example) just like they would modify the short codes above when customizing content. This PHP variable exists largely so that the plugin can be implemented in any area of any template that WordPress manages, instead of just being used in the sidebar and on index pages. Feel free to use it wherever a tweet should be included, however, as its universal appeal will work in any template, anywhere — even alongside traditional short code uses.

Beyond the examples listed here, there are literally tens of variables which can be used to customize the output and content produced by the WP Twitter Feed widget. It is, without a doubt, the closest thing to a real WordPress Twitter widget or content aggregation service. It’s as customizable as anything included natively with the WordPress content management software, while being simple (no control panel) and extensible (using variables) enough for both novice and advanced users.

Sending WordPress Content to the Twitter Feed

Just as important as bringing Twitter content into the WordPress design is sending notifications about new content to the millions of Twitter users who monitor the site for trending topics, new commentary, and blog entries. This cannot be done natively with the WordPress control panel, unfortunately, and so it must be done by installing a plugin that allows for a direct link between the WordPress Dashboard and the Twitter OAuth authentication protocol. The best way to do this is to enlist the help of the “WP To Twitter” plugin for self-hosted installations.

The plugin resides in the standard plugin directory and produces a very simple customized control panel that determines how each post is shared with the world’s most popular microblogging service. Users can opt to include hashtags with every announcement of a new entry, and they can use a URL shortening service to cut down on the size of their large permalink structure. These shortened URLs do not use a website’s native domain, but instead use services like and to link WordPress followers to site content.

Using WP To Twitter

The WP To Twitter plugin service also hooks right into Google Analytics, which allows website operators to see how many Twitter users actually noticed their post-related tweet and clicked through to read the website’s content. Once they’ve landed on the website, users can enjoy raw Analytics data per usual, with information about click rates, page occupation times, and other information that the service is famous for providing.

WP To Twitter Feed

Because it allows for hashtag insertion and automated URL shortening, WP To Twitter is one of the leading WordPress Dashboard plugins for sharing full-length content directly to Twitter in 140 characters or less. The plugins is extremely lightweight, easy to install, and its custom control panel interface means that it’s as easy and intuitive to configure as any other WordPress setting or feature.

Twitter Feed

The Full Approach: Integrating Templates, the Dashboard, and the Twitter API with One Plugin

Relying on so many independent plugins to integrate Twitter functions with the WordPress Dashboard and theme templates isn’t necessarily a bad idea, but mixing so many plugins that query the same website can be a bit problematic. Remember that all of these plugins are interacting with the Twitter website and OAuth protocol, all downloading and submitting the same information, and doing it all within the same database. The potential for bugs, glitches, and lost data is exponentially higher when combining multiple plugins for the same website in this way. In order to cut down on these potential problems, users are encouraged to streamline the process as much as possible by pursuing a policy of Twitter plugin convergence.

This might sound complex, confusing, or even impossible, given WordPress’ tenuous relationship with tweets, but it can actually be accomplished quite easily.

It’s done using the “Twitter Tools” plugin that has long been the single most popular Twitter plugin among WordPress users around the world. It has achieved that distinction by enhancing both the Dashboard and template functionality of the WordPress software, pairing it with a custom control panel, and issuing frequent updates with new features, less bugs, and improved usability.

Twitter Tools first and foremost integrates deeply into the WordPress Dashboard. It installs a customized control panel that allows users to fine tune each of its features and settings; it pairs this control panel with a Dashboard content box which sits right alongside those drag-and-drop boxes which display entry statistics, recent comments, WordPress news, and recent user activity within the Dashboard. This allows for easy, unified access to both the broader Twitter news feed as well as a user-specific news feed as defined in the Twitter Tools administration area.

Beyond that, Twitter Tools allows for generating tweets that link to each new post published within a typical WordPress installation, and it can even enable the use of short URLs that actually employ the user’s domain name rather than third-party sites like Hashtags can be inserted within the Twitter Tools control panel and other default text can be added in this manner as well.

Templates are not left out of this robust plugin’s scope, as users will find it relatively easy to use a PHP variable throughout templates in order to insert tweets in any sidebar, body of content, or independent WordPress page they desire. Twitter Tools allows the appearance of this code to be customized using the plugins’ control panel interface as well; users will find it easy to determine which Twitter user’s tweets are pulled into the site’s templates and how many tweets are displayed. They can also customize the template that determines how each tweet in this list appears, and they cant determine whether hashtags, mentions, or retweets are displayed in this listing of recent posts.

Twitter Tools developer Alex King has even gone outside the box with his tweet-centric plugin and has included the ability to post entire digests of recent tweets for consumption by the site’s frequent visitors. This can be configured in the WordPress Dashboard within the Twitter Tools control panel, and it allows for daily, weekly, or monthly compilation of all tweets into a standard WordPress entry. It can be specially styled, and filed into a special category, all on an automatic and regular basis as the user determines.

Lack of Twitter Integration into WordPress is Easy to Overcome

Sadly, WordPress shows no signs of budging on its stance that any social networking activity will have to be added through the use of plugins. The company happily integrates with major social networks, including Twitter, on its remotely-hosted blogging site, but simply refuses to bring that functionality to its more advanced, customizable self-hosted variant.

Even without native support for Twitter, the large number of available plugins and widgets available to users makes it easy to bring WordPress into the 21st century, even if it does so while kicking and screaming. With recent tweets in WordPress templates, news feed integration into the WordPress Dashboard, and automatically-generated tweets which announce new posts, the plugins mentioned above are a comprehensive approach to combining traditional content management with next-generation microblogging communication methods.

Article by Jerry Low

Geek dad, SEO data junkie, investor, and founder of Web Hosting Secret Revealed. Jerry has been building Internet assets and making money online since 2004. He loves mindless doodling and trying new food.

Get connected: