Return to Snippet

Revision: 43633
at March 28, 2011 14:25 by elijahpaul


Initial Code
// Recent tweets function 
function recentTweets($username, $number){ 
 include_once(ABSPATH.WPINC.'/rss.php'); 

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

 if (!is_wp_error( $tweet ) ) : 
 $maxitems = $tweet->get_item_quantity($number);  
 $rss_items = $tweet->get_items(0, $maxitems);  
 endif; 
 if ($maxitems == 0) echo '<li>No Tweets.</li>'; 
 else foreach ( $rss_items as $item ) { 

 $content = html_entity_decode($item->get_content()); 
 $link = html_entity_decode($item->get_permalink()); 
 $date = $item->get_date('l, g:i a'); 

 echo "<li>$content <a href='$link'>$date</a></li>"; 
 } 
}

Initial URL


Initial Description


Initial Title
Daniel Hellier Original Display Tweet Code

Initial Tags


Initial Language
PHP