Sunday, May 24, 2009

How To : Create a Twitter page on your WordPress blog

Jean-Baptiste Jun already showed you how to display your latest tweet on your blog, in your sidebar for example. Another good way to introduce readers to your Twitter updates is to create a dedicated page for displaying your tweets, using the powerful “Page template” WordPress option.

To perform this hack, you need to know how to create and use page templates. If you’re not familiar with this, this article will tell you all you need to know.

Here’s the code to create a Twitter page template. Paste it in a new file, name the file something like twitter-page.php, for example, and then add it to your blog.


/*
Template Name: Twitter page
*/

get_header();

include_once(ABSPATH.WPINC.'/rss.php');
wp_rss('http://twitter.com/statuses/user_timeline/15985955.rss', 20);

get_sidebar();
get_footer();
?>


This code uses the wp_rss() function from WordPress core, which is an RSS reader. In the first argument I pass my Twitter RSS feed, and in the second argument I determine the number of entries to display.

Related Posts by Categories



0 comments:

 

Copyright 2008 All Rights Reserved Revolution Two Lifestyle theme by Brian Gardner Convert by Bloganol dot com Edit by Arieyblog

top