官术网_书友最值得收藏!

Integrating Twitter on your theme using the Twitter Tools plugin

Twitter is a free micro blogging service that allows you to post short messages (less than 140 characters) by answering the simple question—What are you doing?.

Getting ready

I must admit that I was very skeptical at first about the use of Twitter for a blog. However, I decided to give it a try and found it really helpful. It is a great way to get in touch with other bloggers, interact with your readers, and promote your blog posts. By the way, my twitter URL is http://twitter.com/catswhocode, so don't hesitate to get in touch with me!

However, similar to your RSS feed, in order to invite visitors to your twitter account you have to promote it on your blog—this way your readers will know that you're using Twitter. In my opinion, the best way to tell your readers about your twitter account is to display your tweets on your blog. In this recipe, we'll see how to do it—with and without a plugin.

My favorite Twitter plugin for WordPress is, by far, Twitter Tools—created by Alex King who has released numerous popular WordPress plugins, such as Simple tagging or Share This.

The Twitter Tools plugin is great because it offers so many possibilities; for example, if your theme uses widgets, you can simply drag the Twitter Tools widget to your sidebar and you're done! Twitter Tools also gives you the choice between displaying only your latest Twitter entry or latest page.

Getting ready

How to do it...

  1. To install the Twitter Tools plugin, visit the following link and download it: http://wordpress.org/extend/plugins/twitter-tools/. Then, upload the twitter-tools.php file into your wp-content/plugins directory.
  2. Once you have activated the plugin, a new tab—where you can set up your Twitter Tools options—will appear under Options in your WordPress Dashboard.
  3. With the Twitter Tools plugin, displaying your Twitter entries is made very easy. If your theme is widget-ready, go to Design | Widgets on your WordPress Dashboard and drag the Twitter Tools widget to your sidebar. Once you have saved the modification, your twitter entries will appear on your sidebar.
  4. If your theme isn't widget-ready, you have to edit the sidebar.php file and add the following function:
  5. Display your last tweets: <?php aktt_sidebar_tweets(); ?>
  6. Display only your latest tweet: <?php aktt_latest_tweet(); ?>

How it works...

In order to display your latest Twitter entries, the Twitter Tools plugin uses PHP to parse your Twitter RSS feeds. RSS feeds parsing will be discussed in detail in the following recipe.

主站蜘蛛池模板: 永胜县| 罗甸县| 铜梁县| 台北县| 沈阳市| 南开区| 盘山县| 井陉县| 成都市| 防城港市| 都昌县| 阜平县| 安多县| 永善县| 密云县| 若尔盖县| 仙桃市| 宽甸| 惠东县| 化隆| 竹溪县| 疏勒县| 崇义县| 巫山县| 九龙县| 万荣县| 进贤县| 昔阳县| 安阳县| 鲁山县| 长沙县| 治多县| 塘沽区| 台北县| 合阳县| 贺兰县| 筠连县| 宁明县| 北流市| 宁南县| 金湖县|