NeutralAxisTwitter

Custom “Tweet This” Link

by on Dec.21, 2009, under Blogging
Visited 1882 times, 2 so far today

The basic format for Facebook is this.

<br/><a href="http://www.facebook.com/sharer.php?t=Title of Post&u=http://URL_of_post"><img src="facebook_icon.png" alt="Facebook Share" /></a>

You can automate the title of the post and the URL like this.

<br/><a href="http://www.facebook.com/sharer.php?t=<?php the_title(); ?>&u=<?php the_permalink() ?>"><img src="facebook_icon.png" alt="Facebook Share" /></a>

And in my case where I’m using the YOURLS plugin to generate short URLs, I can further automate the URL to be the short URL.

<br/><a href="http://www.facebook.com/sharer.php?t=<?php the_title(); ?>&u=<?wp_ozh_yourls_raw_url(true); ?>"><img src="facebook_icon.png" alt="Facebook Share" /></a>

Place that in your single post and/or page template and it will send the user to twitter where they’ll be asked to log in, and then the post title and short url are prepositioned for them.  Of course, you’ll also need to adjust the icon filename as needed for your specific case.

Pages: 1 2

:,


Tweet ThisFacebook ShareRight Click & Copy URL

Leave a Reply

See Commenting Guidelines

Notify via Email Only if someone replies to My Comment

Spam protection by WP Captcha-Free

Visit our friends!

A few highly recommended friends...