Matt Gifford aka coldfumonkeh | Consultant Developer
View Github Profile


cfml.us Wordpress Plugin

Oct 12, 2012

I'm a Wordpress user, and have been for as many years as I've been developing (which is a lot, now that I think about it..man, I feel old sometimes). However, I'm primarily a ColdFusion developer, and always want to share the CF love whenever possible.

I developed a simple Wordpress plugin that uses the cfml.us URL shortening service written by Tim Cunningham which will automatically create and store a shortened URL for your pages and posts.

How to..

Installation of the plugin is simple. Download the .zip file and upload it into your Wordpress plugin repository (either FTP or via the admin interface) and activate it.

There are two methods of use.

The first is as a shortcode, which can be used within the content editor for any page or post.

The default shortcode is as follows:

[cfmlus_link]

This will use the default title / lead text and output the link like so:

Short URL: <a href="http://cfml.us/Mf" class="">http://cfml.us/Mf</a>

We can override this a little and specify a different lead text (or nothing at all) and provide a class name for the link using the inline attributes:

[cfmlus_link title="Any other title here" class="my_link_class"]

The second option is to set a function directly within your template code to output the link wherever you want to:

<?php show_cfmlus_link(); ?>

Saved and Stored

When a new URL is generated for the parent page using the plugin, the shortened URL is saved as a custom post meta value. This removes any possible issues with duplicate URLs being generated for the same long URL, and it only needs to be created once.

Grab it

The code is available to download from Github now: https://github.com/coldfumonkeh/cfml.us-Wordpress-plugin

If you're a Mac user and have Alfred App installed (with powerpack) you can also use my cfml.us extension there to create shortened URLs, copied directly to your clipboard.


Latest Blog Posts

Jul 16, 2020
Github Actions with CommandBox and TestBox
Read More
Jul 9, 2020
Azure pipelines with CommandBox and TestBox
Read More
Dec 23, 2019
CFML content moderation detection component library
Read More