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 be easier to set up.
This plugin has been deprecated and no further edits will be made. You can find the public archive on GitHub.
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.
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,
'style'=>'ddmm'
);
$twitter->setOptions($options);
Setup and add all of our user keys and names together:
//Sets the user. If you only want one user just use setUser1
$twitter->setUser1('username1',$user1);
$twitter->setUser2('username2',$user2);
Finally, we can display the feed(s)
echo $twitter->displayTweets();
Setup authentication keys and tokens for the first user.
$username
(String) Required
$keys
(Array) Required
Setup authentication keys and tokens for the 2nd user, if a 2nd user is required.
$username
(String) Required
$keys
(Array) Required
Configure your own options
$options
(Array) Optional
Default
$defaults = array('maxTweets'=> 20,
'style'=>'time_since',
'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:
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.
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
setUser2()
it would always use the id of the first username set in
setUser1()
/*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.
Welcome to Hot Web Dev January 2025, featuring the latest technology and web development news.… Read More
Welcome to Hot Web Dev December 2024, featuring the latest technology and web development news.… Read More
I have heard productivity is key. Sometimes, computers don't behave the way we expect or… Read More
Welcome to Hot Web Dev November 2024, featuring the latest technology and web development news.… Read More
Welcome to Hot Web Dev October 2024, featuring the latest technology and web development news.… Read More
In this tutorial, you’ll build a fun and interactive guessing game using Svelte 5, the… Read More