Solved

Last 3 tweets in WordPress

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

WordPress is constantly evolving, and with each evolution appears to get better and better.  One of the big drawbacks prior to version 3 was that there was no way to be able to set up a custom menu from the backend. The Old Way Adding menus is…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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 integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

747 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

13 Experts available now in Live!

Get 1:1 Help Now