Tag Archives: cloak

Hidden Affiliate Links update version 0.2

There is a new version of this plugin. Please download it from the plugin page

After the first release of the Hidden affiliate Links plugin some bloggers wanted to know if this plugin would be able to automatically replace some keywords in posts and turn them into affiliate links.

John Chow bought a plugin for wordpress that does something like that from DealDotCom (yes it's an afiliate link and it was created automatically ) but I know it wouldn't be that hard to add such a functionality to my plugin. So here's the real deal they should put on DealDotCom:

Now my plugin will let you define keywords and it will replace those keywords (when you save/update a post) with a new link you can specify. And it will still work for adding such links manually as the first version does (just don't put anything into keywords or Link fields ) .

The keywords field is actually a field where you can specify a regular expression ( so make sure you escape special characters like - or . (dot ) by placing a \ ( backslash ) in front of them.

Example Use

Let's say you write a post and you want this plugin to replace both the keywords/phrases DealDotCom and "Deal Dot Com" then the content of the keywords column should look like DealDotCom|Deal Dot Com . The "Match slug" field can be go/dealdotcom and the "New link" should be something like "/go/dealdotcom" or "http://patchlog.com/go/dealdotcom" ( without the quotes ) - this is what it looks like on your blog.

Download new version

Hidden Affiliate Links v0.2 zip file / tar.gz file

Installation

If you have already installed version 0.1 you will have to deactivate from wp-admin -> Plugins and delete the table wp_hal_links then just install the new plugin like any other plugin.

Notes

Because the plugin allows you to specify regular expression for the " Match Slug" field you will have to escape some special characters like . (dot ) , _ , - and / by placing a backslash in front of them . I could make the plugin so that this will not be necessary but that would make it lose the great flexibility that regular expression matching can offer.

ToDo:

  • make it configurable so that the user can chose to match case sensitive or insensitive keywords and link slugs. At the moment the match is case sensitive but some users may not like that. It would also be nice to be able to specify this for each link.
  • give the user the option to replace the keywords at runtime (every time the post is rendered). This has the advantage that the keywords on all posts will be replaced ( not just the ones you update after you install the plugin ) but has the disadvantage that it can slow down your blog
  • Anything else you would like ? feed free to let me know in the comments...