The code for Simple Twitter Link should be added to the bottom of appropriate post/page templates within your theme (and in the case of posts, within the loop).
Simple Twitter Link simply returns a URL - this URL is a link to Twitter with your post/page URL within it. It even uses TinyURL to make the link passed to Twitter even more convenient.
Ok, this may not be making sense yet, so here's an example.
<a href="<?php simple_twitter_link(''); ?>">Send to Twitter</a>
This will display the text "Send to Twitter" on your page/post. However, when clicked on it will take you to your Twitter account and pre-fill in the status with "I'm currently reading xxx", where xxx will be a TinyURL address of the page/post that you just came from.
I hope that makes more sense.
In the case of this example, no parameters were passed and, hence, a default sentence was passed to Twitter. If, however, you'd like to define your own Twitter text, then you simply pass this as the only parameter. %url% must be specified within the sentence, as this tells Simple Twitter Link where you want the TinyURL address to go.
So, another example...
<a href="<?php simple_twitter_link('%url% is an excellent read'); ?>">Send to Twitter</a>
In this case the line "xxx is an excellent read" (again, where xxx is the TinyURL address of your page/post) will be passed to Twitter.
If you don't pass a parameter or miss out the %url% tag the default text will be used.
The following is an example of how it could be used, with a function_exists check so that it doesn't cause problems if the plugin is not active...
<?php if (function_exists('simple_twitter_link')) : ?>
<a href="<?php simple_twitter_link(''); ?>">Send to Twitter</a>
<?php endif; ?>
You can also use an addition tag, %title%, which will show the post/page title in the Twitter text.
Lastly, you can also use a number of additional tags which will override the default TinyURL for shortening URLs. Simply include one of the following...
%bit.ly%
%is.gd%
%snipr%
%su.pr%
%tr.im%
If there are any others that you'd like to see added, please let me know.
This text will then be removed from the resultant output to Twitter. So, here is a further example...
<a href="<?php simple_twitter_link('%tr.im%Currently reading a blog post called "%title%" - %url%'); ?>">Send to Twitter</a>
This uses both the new %title% tag and also overrides the shortening service to the one provided by tr.im.




