Skip to main content Jump to list of all articles

WOW-Multi-Twitter 2.0 Reloaded PHP Class

WOW-Multi-Twitter 2.0 is a PHP class that accesses single or multiple Twitter account feeds via the Twitter API using OAuth, the standard, secure way of interacting with your Twitter feeds. Version 2.0 replaces the following 2 scripts, Multi Twitter Script and Wow Twitter Single. Some of the original code has been reused but because it is object orientated it should definitely be easier to set up.


New Features

  • Display optional images.
  • Uses new customised OAuth wrapper from J7mbo to get access to the API
  • Can work with single Twitter feeds too
  • Object orientated so you can have multiple separate single feeds or multiple double feeds. Currently, a maximum of 2 feeds together at a time.


You should already have a consumer key, consumer secret, access token and access token secret for one or both of your Twitter accounts. If not visit Twitter Apps to create them.
PHP Server with CURL – The script has been tested using PHP 7 but should work for 5.6 and above.
A little knowledge of PHP and CSS is beneficial but not essential.


Simply download, unzip and place on your web server. Be aware that it has an index.php file that would possibly overwrite your current homepage! I recommend that you rename it or simply use the code from it.

How to Use Multi-Twitter

This is just a brief guide on how to use WOW Multi-Twitter 2.0. There is further documentation inside of index.php and throughout the class itself.

Once installed on your server you need to include the script on your PHP page.

<?php include_once 'twitter/includes/wow-multi-twitter.php';?>

Add the keys to interact with the Twitter API:

 //User 1
	$consKey = '';//Add your Twitter Consumer Key here
	$consSec = '';//Add your Twitter Consumer Secret here
	$usrToken = '';//Add your Twitter User Token here
	$usrSec ='';//Add your Twitter User Secret here

	//User 2 If you only want one user, simply ommit any reference to user2
	$consKey2 = '';//Add your Twitter Consumer Key here
	$consSec2 = '';//Add your Twitter Consumer Secret here
	$usrToken2 = '';//Add your Twitter User Token here
	$usrSec2 ='';//Add your Twitter User Secret here

	//Creates an array of the above keys for each user
	$user1 = array($consKey,$consSec,$usrToken,$usrSec);
	$user2 = array($consKey2,$consSec2,$usrToken2,$usrSec2);

Create a new instance of class MultiTwitter:

$twitter = new MultiTwitter();

Add our own options – See properties and methods below for more configurations:

//Sets custom options
$options = array('maxTweets'=> 25,
		 'caching_intervals' => 10,
		 'display_images' =>true,


Setup and add all of our user keys and names together:

//Sets the user. If you only want one user just use setUser1

Finally, we can display the feed(s)

echo $twitter->displayTweets();

Required Methods and Properties


Setup authentication keys and tokens for the first user.

(String) Required

(Array) Required


Setup authentication keys and tokens for the 2nd user, if a 2nd user is required.

(String) Required

(Array) Required


Configure your own options

(Array) Optional


$defaults = array('maxTweets'=> 20,
                  'include_retweets' => false,
                  'include_replies' => false,
                  'caching_intervals' => 60,
                  'display_images' => true

maxTweets- Default 20 (int)
How many tweets you want to fetch from the Twitter Server per account.

style- default ‘time_since’ (string)
Displays the date or time since format.
The arguments are:

  • ‘eng_suff’ – Displays 21st February
  • ‘ddmm’ – Displays 21 Feb
  • ‘ddmmyy’ – Displays 21 Feb 2018
  • ‘full_date’ – Displays Wed 21 Feb 2018
  • ‘time_since’ – Displays the time since the tweet in hours, minutes etc.
  • ‘month’ – Displays February 21, 2018

include_retweets- default false(bool)
Do you want to include any retweets?

include_replies- default false(bool)
Do you want to include any replies?

caching_intervals- default 60(int)
How often in minutes do you want to cache the JSON request?

display_images- default true(bool)
Images are enabled by default but may not show on all tweets. You can optionally disable them.


Output your Twitter feed(s) for the world to see.

Styling our Tweets

There are 3 updated style sheets enclosed. Feel free to roll your own or use any of the themes as a guide. If using multiple feeds and you would like to style each individual feed differently every feed ul is given the id wow-your_username

If you are using 2 feeds combined, ie: using


it would always use the id of the first username set in

/*Styles the Unordered list*/

.wow-twitter {

/*Styles each individual tweet*/

.tweet {

.tweet a {

.tweet a:hover {

.tweet img{

.tweet strong {


Furthermore, if you would like to suggest an improvement to the code or request a new feature then please do get in touch. Although the code has been tested thoroughly it shouldn’t contain any bugs. Please feel free to report them if you do come across any.

Comments are closed.

Discover more from WorldOWeb

Subscribe now to keep reading and get access to the full archive.

Continue reading