Penguination Project


Wordpress twitter button tutorial

twitter-bird-6Hello again friends !

Good news , you don’t need any wordpress twitter plugin for now, we will teach you how to create this plugin yourself !

Twitter button allows to your visitors to tweet every single post. That’s cool enough right ? There are some free widgets available over the net. Tweetmeme.com button for example, but when you are using tweetmeme button , you are automatically retweet tweetmeme.com I don’t want to retweet tweetmeme and probably you also don’t want to retweet them. So let’s create our twitter button from scratch.

First we need button image actually. You can use our happy bird : just save it on your desktop.

twitter1

Ok, let’s do it :

  • Upload this image to your server root
  • Login to wp-admin, click appearance, click editor, on right menu find single.php file, click on it
  • Inside of Single.php find html code one of the following : <div class=”entry”> or <div id=”entry”> after this tag insert code <?$title=get_the_title();?><div style=”float:left;margin-right:.5em;margin-bottom:.5em;”>  <a title=”ReTweet this” href=”http://twitter.com/home?status=<?=urlencode($title)?>+<?php the_permalink();?>”><img border=”0″ src=”<?php echo get_option('siteurl'); ?>/twitter.gif”></a>  </div>
  • Save single.php
  • If you use cacher , clear the cache

Now when everyone visits your blog, he could tweet any post.

Good luck coding and exploring your wordpress blog !

Post Metadata

Date
June 18th, 2009

Author
admin

Category


Leave a Reply