Solved

Last 3 tweets in WordPress

Posted on 2010-08-25
4
576 Views
Last Modified: 2012-05-10
I am current using the wp_echoTwitter code to show the last tweet on my blog. I am looking to show the last 3 tweets.

I have this in my functions.php file:
function wp_echoTwitter($username){

     include_once(ABSPATH.WPINC.'/rss.php');

     $tweet = fetch_rss("http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1");

     echo $tweet->items[0]['atom_content'];

Open in new window


And I have this added to my sidebar
		<h3><?php wp_echoTwitter('twitteruser'); ?></h3>
		<h2><a href="http://twitter.com/twitteruser">Follow twitteruser on Twitter</a></h2>

Open in new window


Any ideas?

Thanks
0
Comment
Question by:vertigogroup
  • 2
4 Comments
 
LVL 4

Expert Comment

by:javaftper
ID: 33522414
All you have to do is change the value of rrp to however many tweets you want to show, so-

$tweet = fetch_rss("http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1");

should be changed to-

$tweet = fetch_rss("http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=3");

0
 

Author Comment

by:vertigogroup
ID: 33522530
I tried that but it still showed only 1. Do I need to wait an hour before it displays?
0
 
LVL 3

Accepted Solution

by:
wuff earned 500 total points
ID: 33523861
You are still accessing the first one. You need to loop them through. Check this update of the function:

http://jhnk.pastebin.com/5A4aXYTW
0
 

Author Closing Comment

by:vertigogroup
ID: 33524089
Works like a charm. Thanks!
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question