[SHORTCODE] Tiny URL

Post Reply
User avatar
Fred
Legend Bludit
Posts: 236
Joined: Wed Jun 24, 2015 2:14 pm
Location: France
Contact:

Hi,

This shortcode add short url with tinyurl API service.
In your shortcode plugin configuration, add this tip:

Code: Select all

	// Add Shortcode: {Tiny url='http://www.bludit.com'}
	Shortcode::add('Tiny', function ($attributes) {	
	    // Extract
	    extract($attributes);
	    $url = (isset($url)) ? file_get_contents('http://tinyurl.com/api-create.php?url='.$url) : '';
	    // return
	    return $url;
	});
Now in your posts/pages, add this shortcode :

Code: Select all

{Tiny url='http://www.bludit.com'}
Result:

Code: Select all

http://tinyurl.com/gs3zxbp
╰☆╮Bludit╰☆╮ is a open source and community contributions are essential to project success!
You are looking for a light forum based Json? Try my project Flatboard, it is free. ;)
Sorry for my little english, i'm french :oops:
Post Reply