Auto Content Links

Plugin Info

Plugin Name: Auto Content Links
Plugin URI: http://redyellow.co.uk/plugins/auto-content-links/
Download URI: http://wordpress.org/extend/plugins/auto-content-links/
Description: Automatically convert words in your posts to links without having to worry about creating them manually!
Author: Rich Gubby
Version: 1.1
Author URI:http://redyellow.co.uk/

BEver find yourself turning same words over and over again into links in your content? Well not any longer! Auto Content Links allows you to set up specific words in your content, and replace them with a link to wherever you want.

Installation

  1. To install through WordPress Control Panel:

    • Click “Plugins”, then “Add New”
    • Enter “Auto Content Links” as search term and click “Search Plugins”
    • Click the “Install” link on the right hand side against “Auto Content Links”
    • Click the red “Install Now” button
    • Click the “Activate Plugin” link
  2. To download and install manually:
    • Upload the entire auto-content-links folder to the /wp-content/plugins/ directory.
    • Activate the plugin through the Plugins menu in WordPress.

FAQ

My replacements inside of the href are messed up!

f you have looped your replacements – maybe you have google to be replaced with bing, and bing to be replaced with google. It’ll get itself into a mess and cause your post to look bad.

Avoid looping.

Changelog

1.1

  • Much improved regular expression – thanks to Rodger Zeisler & son!
  • Fixed some styling

1.0

  • Added first version
Be Sociable, Share!

5 Responses to “Auto Content Links”

  1. Rodger Zeisler says:

    I like your Auto Content Links plugin. It worked in most cases but I had some problems with text being modified inside anchor and image HTML tags (which corrupted the HTML). I also had problems with text that had been linked being relinked (overridden) by this plugin (which made the link not go where it had originally been linked).

    My son, Ryan, looked at your code and made a change to auto-content-links.php to not allow content to be auto-linked if it was within an HTML tag (like an anchor or img tag) and to not relink text that is already linked. Within function autoContentLinksContent, right before the return you assign a value to $content using preg_replace. That line was modified as follows:

    $content = preg_replace(‘@(‘.$wordBoundary.$link['name'].$wordBoundary.’)(?!([^]*<[^Aa]+>)* ([^]+)?)(?!([^)@’, ‘<a href=”‘.$link['url'].’” rel=”nofollow”>’.$link['name'].’</a>’, $content, $link['instances']);

    If you would incorporate this into your plugin, I won’t have to worry about updates and you will have a more bulletproof plugin. If what I pasted in doesn’t make it thru this comment post, you can email me and I will send the updated file directly to you.

  2. Rich Gubby says:

    That’s awesome – please be sure to thank your son for the regular expression – very much appreciated!

    I’ll try and get the new code implemented as soon as I can!

  3. Rodger Zeisler says:

    I just emailed you an update to the auto-content-links plugin. We found a situation where wordpress short codes were being mangled so we added a little to the regular expression so it would not try to link matching words inside brackets, just like we had done for HTML tags.

  4. Rich Gubby says:

    Latest version has your new regular expression in – many many thanks!

  5. Rodger Zeisler says:

    I see you released version 1.2 that includes an option to open the link in a new window. Awesome! One suggestion…instead of using target=_new, I would recommend using target=_blank. This will always open the link in a new window instead of opening a new window once and then refreshing that same window. Read this post for some insight:

    http://www.russellheimlich.com/blog/target_blank-vs-target_new/

    Thanks for all your efforts.

Leave a Reply