Version 3.x

(Last updated for Version 3.1.1) 




About Version 3.x

The URL Shortener WordPress Plugin has been completely re-written from ground up to provide a cleaner code base and to take advantage of WordPress 3.0’s new shortlink feature while keeping compatibility with previous WordPress versions.


Installation

View Guide

Supported Services

  • Common:
    • bit.ly
    • Su.pr
    • tinyurl
    • Ping.fm
    • Digg
    • is.gd
    • snipurl / Snurl / Snipr / Sn.im / Cl.lk

  • Others:
    • cl.gs
    • short.ie
    • chilp.it
    • smsh (aka sm00sh)
    • urli.nl
    • unfake.it
    • awe.sm
    • Voizle
    • soso.bz
    • Interdose API
    • Cuthut.com


Usage

Initial Setup

    1. Upon plugin activation, go to Settings > URL Shortener to select your options

    2. Shortlinks / Short URL will now be automatically generated for all posts/pages using the selected shortening service.



Bulk Deleting

  1. You can also bulk delete Shortlink / Short URLs 





Template Tags

On demand shortening of URL

      • fts_shorturl($url, $service, $output = true, $key='', $user='')
      • Parameters:
        • $url: the url to be shortened
        • $service: the name of supported url service
        • $output (optional): if set to false, result will be returned instead of echo’ed
        • $key (optional): User API key
        • $user (optional): Username

      • Eg: <?php fts_shorturl('http://www.google.com', 'bitly'); ?>


Displaying Post / Page shortlinks

      • Option 1: (for WP 3.0 and above)
        • <?php the_shortlink(); ?>
        • http://codex.wordpress.org/Function_Reference/the_shortlink

      • Option 2 (used within the Loop)
        • fts_show_shorturl($post, $output = true)
        • Parameters:
          • $post 
          • $output (optional): if set to false, result will be returned instead of echo’ed
        • Eg: <?php fts_show_shorturl($post); ?>


Shortcodes

    • Support only for Version 3.1 onwards 
    • Usage Variations:
      1. [shortlink]
      2. [shortlink name="display name"]
      3. [shortlink url="http://localhost"]
      4. [shortlink name="display name" url="http://localhost"]
      5. [shortlink]http://localhost[/shortlink]
      6. [shortlink service="bitly"]http://localhost[/shortlink] 
    • Parameter descriptions
      • name: Link Text 
      • url: The URL that needs to be shortened
      • service: URL service to use
      • key: user pass/key
      • user: username

    • Caveat: Try not to combine usage variations



Settings and Options

General

Main Settings

      • URL Shortener Integration
        • When enabled, Shortlink /Short URLs will be generated upon post / page publishing.
        • It doesn’t affect the Nice ID URL option.

      • Use Permalinks for Short URLs
        • When enabled, permalinks will be used to generate the shortlinks
        • By default, shortlinks are generated using http://your_site/index.php?p=123 as this will ensure shortlink will work regardless of page permalink or slug.

      • (Ver 3.1.1) Append Short URL to
        • Choose whether to append a link to the generated Short URL to homepage, individual post page or individual site pages.

      • (Ver 3.1.1) Text before Short URL link
        • Provide a pre-text before the Short URL

URL Service Configuration

      • Configure your preferred URL Shortening Service. 
      • Services which require authentication will be marked with a red asterisk *


Note: Above screenshot is the interface for Version 3.0. It has been slightly modified in 3.1.1

Additional Features

Nice ID

      • Nice ID URLs
        • When enabled, allows use of http://your_site/123 instead of the usual http://your_site/index.php?p=123 or http://your_site/index.php?page_id=123
        • Formally named template URL, but redirection method has been changed.

      • Nice ID URL Prefix
        • This prefix will be added to your Nice ID URLs... default is / 

Shortcode

      • (Ver 3.1) Disable Shortcode [shortlink]
        • Provides the option to disable the shorturl shortcode in the event that it conflicts with other plugin's shortcode of the same name


Action and Filters

fts_use_shortlink (Action Hook)

    • Parameters:
      • $post_id
      • $shortlink: Generated shortlink

    • Example Usage:
  
    function duplicate_field($post_id, $shortlink){
        add_post_meta($post_id, 'duplicate', $shortlink);
    }
    add_action('fts_use_shortlink', 'duplicate_field', 10, 2)
 

      • The above code snippet will add another custom field with your shortlink/shorturl to your post


fts_filter_shortlink (Filter)

    • Parameters:
      • $post_id
      • $shortlink: Generated shortlink



.