Latest Tweets Widget

Latest Tweets Widget

Wordpress plugin

Install on Wordpress

App Details

Connect your Twitter account to this plugin and the widget will display your latest tweets on your site.

This plugin is compatible with the new Twitter API 1.1 and provides full OAuth authentication via the WordPress admin area.

Built by @timwhitlock / Tim Whitlock

The underlying Twitter API library is available on Github

Also by this author: Loco Translate

Shortcodes

You can embed tweets in the body of your posts using a WordPress the shortcode [tweets].

To specify a different user’s timeline add the user attribute.
To override the default number of 5 tweets add the max attribute, e.g:

[tweets max=10 user=timwhitlock]<h3>Theming</h3> 

For starters you can alter some of the HTML using built-in WordPress features.
See Widget Filters
and Widgetizing Themes

CSS

This plugin contains no default CSS. That’s deliberate, so you can style it how you want.

Tweets are rendered as a list which has various hooks you can use. Here’s a rough template:

.latest-tweets { /* style tweet list wrapper */ } .latest-tweets h3 { /* style whatever you did with the header */ } .latest-tweets ul { /* style tweet list*/ } .latest-tweets li { /* style tweet item */ } .latest-tweets .tweet-text { /* style main tweet text */ } .latest-tweets .tweet-text a { /* style links, hashtags and mentions */ } .latest-tweets .tweet-text .emoji { /* style embedded emoji image in tweet */ } .latest-tweets .tweet-details { /* style datetime and link under tweet */ } 

Custom HTML

If you want to override the default markup of the tweets, the following filters are also available:

  • Add a header between the widget title and the tweets with latest_tweets_render_before
  • Perform your own rendering of the timestamp with latest_tweets_render_date
  • Render plain tweet text to your own HTML with latest_tweets_render_text
  • Render each composite tweet with latest_tweets_render_tweet
  • Override the unordered list for tweets with latest_tweets_render_list
  • Add a footer before the end of the widget with latest_tweets_render_after

Here’s an example of using some of the above in your theme’s functions.php file:

add_filter('latest_tweets_render_date', function( $created_at ){ $date = DateTime::createFromFormat('D M d H:i:s O Y', $created_at ); return $date->format('d M h:ia'); }, 10 , 1 ); add_filter('latest_tweets_render_text', function( $text ){ return $text; // <- will use default }, 10 , 1 ); add_filter('latest_tweets_render_tweet', function( $html, $date, $link, array $tweet ){ $pic = $tweet['user']['profile_image_url_https']; return '<p class="my-tweet"><img src="'.$pic.'"/>'.$html.'</p><p class="my-date"><a href="'.$link.'">'.$date.'</a></p>'; }, 10, 4 ); add_filter('latest_tweets_render_after', function(){ return '<footer><a href="https://twitter.com/me">More from me</a></footer>'; }, 10, 0 );<h3>Caching</h3> 

Responses from the Twitter API are cached for 5 minutes by default. This means your new Tweets will not appear on your site in real time.

This is deliberate not only for performance, but also to avoid Twitter’s strict rate limits of 15 requests every 15 minutes.

You can override the 300 second cache by using the latest_tweets_cache_seconds filter in your theme as follows:

This would extend the cache to 1 minute, which is the lowest value you should consider using on a live site:

add_filter('latest_tweets_cache_seconds', function( $ttl ){ return 60; }, 10, 1 ); 

This would disable the cache (not recommended other than for debugging):

add_filter('latest_tweets_cache_seconds', function( $ttl ){ return 0; }, 10, 1 );<h3>Emoji</h3> 

If you want to disable Emoji image replacement, you can filter the replacement callback function to something empty, e.g:

add_filter('latest_tweets_emoji_callback', function( $func ){ return ''; } ); 
  • or to strip Emoji characters from all tweets, return your own replacement function that returns something else, e.g:

    add_filter(‘latest_tweets_emoji_callback’, function( $func ){
    return function( array $match ){
    return ‘‘;
    };
    } );

    Credits

    Screenshot taken with permission from http://stayingalivefoundation.org/blog

  • Portuguese translations by Leandro Dimitrio

  • German translations by Florian Felsing and David Noh
  • Russian translations by Andrey Yakovenko
  • Dutch translations by Daniel Wichers
  • Spanish translations by Pedro Pica

Notes

Be aware of Twitter’s display requirements when rendering tweets on your website.

Example code here uses PHP closures which require PHP>=5.3.0 and won’t work on older systems.

Pricing

Starting from $0 per month.

Check Out the Image Gallery Widget

By Common Ninja

Image GalleryTry For Free!

App Info

Rating

Reviewers

33 reviews

Tags

api
oauth
rest
tweets
twitter

Developed By

Tim W

Quick & Easy

Find the Best Wordpress plugins for you

Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!

Testimonial

Testimonial plugins for Wordpress

Galleries

Galleries plugins for Wordpress

SEO

SEO plugins for Wordpress

Contact Form

Contact Form plugins for Wordpress

Forms

Forms plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Sliders

Sliders plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Comments

Comments plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Maps

Maps plugins for Wordpress

Security

Security plugins for Wordpress

Translation

Translation plugins for Wordpress

Ads

Ads plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Music Player

Music Player plugins for Wordpress

Backup

Backup plugins for Wordpress

Privacy

Privacy plugins for Wordpress

Optimize

Optimize plugins for Wordpress

Chat

Chat plugins for Wordpress

Countdown

Countdown plugins for Wordpress

Email Marketing

Email Marketing plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Membership

Membership plugins for Wordpress

popup

popup plugins for Wordpress

SiteMap

SiteMap plugins for Wordpress

Payment

Payment plugins for Wordpress

Coming Soon

Coming Soon plugins for Wordpress

Ecommerce

Ecommerce plugins for Wordpress

Customer Support

Customer Support plugins for Wordpress

Inventory

Inventory plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Testimonials

Testimonials plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Slider

Slider plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Membership

Membership plugins for Wordpress

Forms

Forms plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Contact

Contact plugins for Wordpress

Comments

Comments plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Common Ninja Apps

Some of the best Common Ninja plugins for Wordpress

Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.

Image Gallery for Wordpress logo

Image Gallery

Showcase photos with an image gallery that displays pictures and captions in grids, improves design, and boosts visitor engagement.

PDF Viewer for Wordpress logo

PDF Viewer

Add a PDF viewer to your site to display documents, share product information, and give visitors easy access to helpful content in one place.

Corner Button for Wordpress logo

Corner Button

Corner button that stays fixed on the screen to highlight promotions, improve navigation, and guide visitors toward important actions with clear visibility.

Threads Feed for Wordpress logo

Threads Feed

Show Threads posts in a live feed that keeps content fresh, builds social proof, and helps visitors engage on your site.

AdBlocker Detector for Wordpress logo

AdBlocker Detector

Detect ad blockers on your site to maintain visibility into user behavior and support sustainable ad-based monetization.

TikTok Carousel for Wordpress logo

TikTok Carousel

Show TikTok videos with a TikTok carousel that arranges clips in a smooth, customizable layout to boost engagement and keep visitors watching.

Timeline for Wordpress logo

Timeline

Use a timeline widget to display events and milestones in chronological order with images and text so visitors understand your story clearly.

Glossary for Wordpress logo

Glossary

Create an interactive glossary that displays clear definitions, images, and search options to help visitors learn terms quickly and navigate complex topics with ease.

Music Player for Wordpress logo

Music Player

Add a no-code music player to your site to stream audio, share playlists, and support multiple formats with easy setup.

WhatsApp Chat for Wordpress logo

WhatsApp Chat

Add WhatsApp Chat to your site to communicate with visitors, deliver instant support, and create a smoother, more trustworthy user experience.

Instagram Carousel for Wordpress logo

Instagram Carousel

Show Instagram posts in a responsive carousel layout to enhance social proof and keep your site content visually fresh.

Social Proof Avatars for Wordpress logo

Social Proof Avatars

Display social proof avatars that show user activity and ratings, build trust instantly, and help visitors feel confident about your credibility.

More plugins

plugins You Might Like

Discover Apps By Platform

Discover the best apps for your website

WordPress
Wix
Shopify
Weebly
Webflow
Joomla
PrestaShop
Shift4Shop
WebsiteX5
MODX
Opencart
NopCommerce

Common Ninja Search Engine

The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!

Multiple platforms