DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

Some times ago, I shown you how to display your last twitter entry on your WordPress blog. Today, let’s create a button to allow your visitors to send the current post they’re reading to twitter.

Nothing hard with this recipe: Simply paste the following code on your single.php file, within the loop:

<a href="http://twitter.com/home?status=Currently reading <?php the_permalink(); ?>" title="Click to send this page to Twitter!" target="_blank">Share on Twitter</a>

Your readers are now able to send your post url to twitter! Hope it will bring you some traffic and new readers!

Thanks to BabyGotMac for letting me know about this nice code!

Tags

3 Comments

  1. nice.
    but an iframe is a better solutioin:

    <iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url=&via=xtapit&text=” style=”width:115px; height:21px;”>

  2. Nice code! But you’d want to put %20 for the spaces in the link, just to make sure the text came out alright.

  3. Nice code! But you’d want to put %20 for the spaces in the link, just to make sure the text came out alright.

Leave a Comment

Your email address will not be published. Required fields are marked *