Plugin Directory

Simple URL Shortener

Author: David Artiss

From version 1.1 a cache system is used - please read the installation notes for ensuring that the new caching facility correctly works

The code to access Simple URL Shortener can be put anywhere within your WordPress theme, where you need to convert a long URL to a short one.

Here is an example...

<?php echo simple_url_shortener('http://www.artiss.co.uk','is.gd'); ?>

This will display the is.gd shortened URL for http://www.artiss.co.uk.

There are 2 parameters..

The first parameter is the URL that you wish to have shortened. If left blank it will use the URL of the current post/page.

The second parameter is the shortening service that you want to use. This can be one of the following

  • a.gd
  • a.nf
  • buk.me
  • bit.ly
  • chilp.it
  • cli.gs
  • fwd4.me
  • hex.io
  • is.gd
  • idek.net
  • j.mp
  • kissa.be
  • pic.gd
  • r.im
  • safe.mn
  • sai.ly
  • short.to
  • sl.ly
  • su.pr
  • tinyurl
  • tr.im
  • u.nu
  • unfake.it
  • vtc.es
  • xr.com
  • zz.gd

Here is a further version of the original example, but this time with a check to confirm that the plugin is active...

<?php if (function_exists('simple_url_shortener')) : ?>
<?php echo simple_url_shortener('http://www.artiss.co.uk','is.gd'); ?>
<?php endif; ?>

From version 1.1 a cache system is used, whereas the shortened URL is only fetched once from the shortening service provider - after that it is saved and retrieved from a cache in the plugin folder. This greatly improves performance.

However, if you wish to switch it off you can do, via the second parameter. When doing this, the service name must be prefixed too. For example, using the above example, but switching the cache off, you'd type...

<?php if (function_exists('simple_url_shortener')) : ?>
<?php echo simple_url_shortener('http://www.artiss.co.uk','service=is.gd&cache=no'); ?>
<?php endif; ?>

Note the ampersand which is seperating the parameters.

Download

FYI

Compatibility beta

Your Setup

Log in to vote.

The Consensus

No data
100,1,1

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(1 ratings)