Posted By

Ben on 07/21/09


Tagged

php twitter


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

rickfu
irishsk
creativeboulder


Creating a twitter widget in the Wordpress function.php file


 / Published in: PHP
 

I found this code for adding a custom twitter widget to your functions file, it's been useful on more that a few occasions. So thought I would add it to the blog as well as development. As the code needs the twitterupdatelist ID it's not possible to put more than one of these on a page so I haven't made it into a multiple widget.

  1. <?php function widget_mytheme_twitter() { ?>
  2. <div>
  3. <ul><li><h2><a href="http://twitter.com/MYTWITTER">My Twitter Feed</a></h2>
  4. <ul id="twitter_update_list" ><li><script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
  5. <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/MYTWITTER.json?callback=twitterCallback2&amp;count=5"></script></li></ul>
  6. </li></ul></div>
  7. <?php } if ( function_exists('register_sidebar_widget') )
  8. register_sidebar_widget(__('Twitter feed'), 'widget_mytheme_twitter'); ?>

Report this snippet  

You need to login to post a comment.