Return to Snippet

Revision: 66760
at June 30, 2014 16:10 by daprela


Initial Code
/* Generate The Tiny URL - Add to your functions.php file */

function getTinyUrl($url) {
$gettiny = file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
return $gettiny;
}

/* Call The Tiny URL - Add to your single.php file within the loop */

<?php 
$tiny = getTinyUrl(get_permalink($post->ID)); 
echo 'Tiny Url: '.$tiny.''
?>

Initial URL


Initial Description
Generate The Tiny URL to add to any post

Initial Title
Add a Tinyurl link

Initial Tags
wordpress

Initial Language
PHP