Friday, October 29, 2010

Display last tweets on your wordpress blog

March 14, 2010 by stefan · Leave a Comment 

It is very useful to show your Twitter account on your wordpress blog by displaying your last tweets. To do this, we need to accomplish 2 steps.

First step

Open in editor function.php file and add at the end the code below:


<?php
function displayLatestTweet($twitterID){
 include_once(ABSPATH.WPINC.'/rss.php');
 $latest_tweet = fetch_rss("http://search.twitter.com/search.atom?q=from:" . $twitterID . "&rpp=1");
 echo $latest_tweet->items[0]['atom_content'];
}
?>

Second step

Open in editor the sidebar.php file and add next code:

<h2>Latest Tweet</h2>
<p><?php displayLatestTweet('twitter_account'); ?></p>

Do not forget to change the twitter_account to your Twitter account name.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • FriendFeed
  • Netvibes
  • Reddit
  • RSS
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Twitthis
  • Blogosphere News
  • email
  • LinkedIn
  • Linkter
  • Live
  • MyShare
  • MySpace
  • Ping.fm
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Related posts:

  1. WordPress 3.0:Style WordPress editor using CSS
  2. Modify the footer into the WordPress admin
  3. WordPress 3.0: Make your theme compatible with WordPress 3.0 menus
  4. Threadsy: email, facebook and twitter
  5. show only some categories o wordpress menu

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

SEO Powered by Platinum SEO from Techblissonline