/ Published in: PHP
Generate The Tiny URL to add to any post
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* 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.'' ?>