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

  • WordPress 2.7 Cookbook
  • Jean-Baptiste Jung
  • 426字
  • 2021-04-01 13:55:50

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.

主站蜘蛛池模板: 南和县| 普兰店市| 岳池县| 靖远县| 阿巴嘎旗| 西丰县| 嘉定区| 昔阳县| 东城区| 台中市| 永川市| 奉节县| 边坝县| 蓬安县| 潜江市| 新乡县| 酒泉市| 平南县| 深州市| 通江县| 上饶县| 平远县| 柯坪县| 阜南县| 贡觉县| 绥江县| 大名县| 桐庐县| 贵州省| 土默特右旗| 叙永县| 吐鲁番市| 江油市| 张家川| 专栏| 虎林市| 勃利县| 巴东县| 庆云县| 将乐县| 时尚|