Last year Twitter decided to change the way Twitter interacts with the rest of the world, by making it more difficult to integrate its twitter-streams with your own website. While you can get around this if you can deploy server-side software and go through the hassle of signing up for a developer key, a lot of folks run websites without being interested in having to program just to get their own tweets to display.
Twitter does have a solution, but this just dumps the stream on your site with the lay-out and styling of Twitter. While this is understandable from a branding and marketing point of view, it’s incredibly annoying to have your website look like a hash of different styles just because Twitter doesn’t like you changing the lay-out. So there are a lot of people looking for alternatives.
The best alternative I’ve found for my purpose is http://jasonmayes.com/projects/twitterApi/. Jason Mayes twitter API just takes the formatted twitter-feed, removes the formatting and provides the stream with normal tags to the page. Using standard CSS you can then style the stream and presto, you have a nice looking twitter feed.
How it works in WordPress is as follows:
– Download the software from http://jasonmayes.com/projects/twitterApi/
– Upload the javascript file “twitterFetcher_min.js” to your website. This could be as media but I chose to use FTP to upload it into a theme. As long as it’s on your website it’s okay though, the location is unimportant.
– Add a Text widget to the page where you want the tweets to show up.
– Include the following text in the widget:
<script src="/{path}/twitterFetcher_min.js"></script>
<div id="tweet-element">Tweets by Ronald Kunenborg</div>
<script>
var configProfile = {
"profile": {"screenName": '{yourtwittername}'},
"domId": 'tweet-element',
"maxTweets": 10,
"enableLinks": true,
"showUser": true,
"showTime": true,
"showImages": true
};
twitterFetcher.fetch(configProfile);
</script>
Replace “{yourtwittername}” with your own twitter name (of that of someone whose timeline you wish to show), and the {path} with the path of the uploaded javascript and you’re good to go. However, this looks pants. So we need to style it. In order to do that, include the following text in the widget before the script:
<style>
/*
* Tweet CSS - on Jason Mayes tweetgrabber (http://jasonmayes.com/projects/twitterApi/)
*/
div#tweet-element ul {
list-style: none;
}
div#tweet-element h2 {
clear:both;
}
div#tweet-element p {
font-size: 9pt;
margin: 0 0 0 0;
}
div#tweet-element ul li {
list-style:none;
overflow:hidden;
border-top:1px solid #dedede;
margin: 5px 0 10px 0;
padding: 0px;
}
div#tweet-element ul li:hover {
background-color:#f0f3fb;
}
/* tekst of tweet */
.tweet {
clear: left;
}
.user {
clear:left;
float:left;
}
.user a {
}
/* hide the @twittername, which is the 3rd span in the user class */
.user span:nth-child(3) {
display: none;
}
.user a > span {
margin-left:2px;
}
.user a > span {
display: table-cell;
vertical-align: middle;
margin: 5px;
padding: 5px;
}
.widget-text img,
.user a span img {
display: block;
float:left;
max-width: 40px;
margin: 2px 2px 2px 2px;
}
div#tweet-element p.timePosted {
clear: left;
font-style: italic;
}
div#tweet-element p.timePosted a {
color: #444;
}
.interact {
float:left;
margin-top:-7px;
width: 100%;
}
.interact a {
margin-left: 0px;
margin-right: 5px;
width: 30%;
}
.interact a.twitter_reply_icon {
float:left;
text-align: center;
}
.interact a.twitter_retweet_icon {
float:left;
text-align: center;
}
.interact a.twitter_fav_icon {
float:right;
text-align: center;
}
/* show media on front-page - hide it with display:none if you don't want to show media included by others. */
.media img {
max-width:100%;
}
#linkage {
position:fixed;
top:0px;
right:0px;
background-color:#3d3d3d;
color:#ffffff;
text-decoration:none;
padding:5px;
width:10%;
font-family:arial;
}
</style>
Make sure the <style> part is first in the Text widget.
Of course you can also put the style (without the <style> tags) in a stylesheet (.css) file, upload it and then refer to it, instead of pasting the stylesheet in the Text widget. In that case use the following command:
<link rel='stylesheet' id='twitter-css' href='/{path}/twitter-style.css' type='text/css' media='all' />
And please replace {path} with the desired path.
I hope this helps you as much as it helped me.