Skip to content

Instantly share code, notes, and snippets.

@lmullen
Created November 18, 2010 17:29
Show Gist options
  • Save lmullen/705312 to your computer and use it in GitHub Desktop.
Save lmullen/705312 to your computer and use it in GitHub Desktop.
Code for a WordPress widget that will display the latest on THATCamp from Twitter
<?php
include_once(ABSPATH . WPINC . '/rss.php');
$rss = fetch_rss('http://search.twitter.com/search.atom?q=thatcamp');
$maxitems = 3;
$items = array_slice($rss->items, 0, $maxitems);
?>
<ul id="twitter">
<?php if (empty($items)) echo '<li>No items</li>';
else
foreach ( $items as $item ) : ?>
<?php if($item['author_name'] == 'huberthsu (huberthsu)') continue; ?>
<li><a href="<?php echo $item['author_uri']; ?>"><img src="<?php echo $item['link_image'] ?>" alt="<?php echo $item['author_name'] ?>" /></a>
<p><a href="<?php echo $item['author_uri'] ?>"><?php echo $item['author_name']; ?></a> <?php echo $item['title']; ?></p></li>
<?php endforeach; ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment