Sometimes it’s just easier to hard code something into a WordPress theme. Many is a time I’ve spent a half hour looking for a plugin to “just do it for me” only to get back a truly ugly button that not even a mother could love.
You can use this anywhere in the wordpress loop to make a simple ‘tweet this’ link:
1 2 3 4 5 6 7 8 9 10 11 12 | <div id="custom-tweet-button"> <?php $twitter_permalink = urlencode(get_permalink($post->ID)); $twitter_via=urlencode('twitterusername'); $twitter_post_title = strip_tags(get_the_title( $post->ID )); $twitter_blog_title = urlencode(get_bloginfo('name')); ?> <a href="http://twitter.com/share?url=<?php print $twitter_permalink ?>&text=<?php print $twitter_post_title ?>&via=<?php $twitter_via ?>" target="_blank" title="Tweet this">Tweet</a> </div> |
And remember to always theme with care.
