/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// 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 ) { $date = $item->get_date('l, g:i a'); echo "<li>$content <a href='$link'>$date</a></li>"; } }