Solved

Last 3 tweets in WordPress

Posted on 2010-08-25
4
568 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

WordPress can be pretty daunting, especially for a beginner, so I thought it might be a good idea to write an article to show how easy it is to get started in WordPress and to design a custom theme.  The first step is to check with your hosting comp…
This article discusses how to create an extensible mechanism for linked drop downs.
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

867 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now