Magic: The Gathering Gatherer Autolinker WordPress Plugin

Feb142009 11:45PM — John

This plugin was updated on April 18th, 2009 to version 0.3, previous versions of the plugin may not work.

Magic: The Gathering Gatherer Autolinker is a WordPress plugin that takes special tags in your posts and converts them into links to the beta version of Gatherer, the official Magic: The Gathering online card database.

Installation

  1. Download and unzip the plugin.
  2. Upload mtgautolinker.php to wp-content/plugins.
  3. Activate the plugin inside of WordPress.

Usage

Anywhere inside of your post you can put [mg]Card Name[/mg] tags and it will appear as Card Name on your blog. The card name you use does have to be exact and there isn’t a way to speicify custom link text, but anyone with even basic PHP knowledge could add one with little effort. If you’d like it to work in comments too just add add_filter('comment_text', 'mgreplacer'); under the addfilter line at the bottom of the file before ?>.

Source

This plugin really couldn’t be any simpler, you could have done it with minimal time and effort.
<?php
/*
Plugin Name: MTG Gatherer Autolinker
Plugin URI: http://tragicallynull.com/2009/02/14/magic-the-gathering-gatherer-autolinker-wordpress-plugin
Description: Autolinks Magic: The Gathering cards to the newly released version of the Gatherer (card database) using [mg]Card Name[/mg] tags.
Version: 0.3
Author: John Stone III
Author URI: http://tragicallynull.com
*/

function mgreplacer ($text){
$mgreplace = '/(\[mg\])(.+)(\[\/mg\])/';
$mgreplacement = '<a href="http://gatherer.wizards.com/Pages/Search/Default.aspx?name=+[&quot;\\2&quot;]">\\2</a>';
$text = preg_replace($mgreplace, $mgreplacement, $text);
return $text;
}
add_filter('the_content', 'mgreplacer');
?>

It’s really so simple just about anyone can edit it to make other custom “autolinkers” of their own.

Advertising

2 Comments

Did you install this plugin in your own blog?
Where it’s possible to see it in its natural form?

Mar192009

@Iflexion:
It’s a pretty simple concept, I didn’t think a demo was necessary.

Mar212009

Leave a comment


Advertising