Return to Snippet

Revision: 23916
at February 16, 2010 15:55 by vagrantradio


Initial Code
//place in functions.php in theme folder
<?php function getTinyUrl($url) { $tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url); return $tinyurl; } ?>
 
//call the function on the page
<a href="http://twitter.com/home?status=Currently reading <?php the_title(); ?> : <?php $turl = getTinyUrl(get_permalink($post->ID)); echo $turl ?>" title="Tweet this">Twitter link</a>

Initial URL

                                

Initial Description
Creates a tiny url for posting on twitter etc.

Initial Title
CREATE TINY URL FOR POSTS IN WORDPRESS

Initial Tags
url, link, wordpress, function

Initial Language
PHP