Add a Tinyurl link


/ Published in: PHP
Save to your folder(s)

Generate The Tiny URL to add to any post


Copy this code and paste it in your HTML
  1. /* Generate The Tiny URL - Add to your functions.php file */
  2.  
  3. function getTinyUrl($url) {
  4. $gettiny = file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
  5. return $gettiny;
  6. }
  7.  
  8. /* Call The Tiny URL - Add to your single.php file within the loop */
  9.  
  10. <?php
  11. $tiny = getTinyUrl(get_permalink($post->ID));
  12. echo 'Tiny Url: '.$tiny.''
  13. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.