How to add ‘Twitter This’ links to your WordPress Posts
Twitter seems to be the preferred social network now so I decided I needed some ‘Twitter This’ links on my WordPress Blogs.
You’ll want to add this link to both the index.php and the single.php pages in your theme. Every theme is different so I can’t tell you exactly where to add it. I find the comments section in those pages and work my way up to where the date, tags or other miscellany is stored and added them there on my themes.
The link you’ll want is:
<p><a href=”http://twitter.com/home?status=Reading:<?php echo urlencode(get_permalink(get_the_ID())); ?>&title=<?php echo urlencode(get_the_title(get_the_ID())); ?>”>Twitter this</a></p>
You might also check out James Wilkes Design version of the link He is pickier than I about the encoding.
Many thanks to:
Jamie Huskisson and to James Wilkes Design who gave me the pieces I needed to put the link together correctly.
Leave a Reply
You must be logged in to post a comment.