WordPress – Create an instant link to Wikipedia

Due to updates, over time, that have been made to the site and the age of this article, this post may not display correctly. In particular images may be missing or product reviews display incorrectly.

If this is the case and you'd particularly like me to fix it, then please reach out to me on Twitter.

I’m often wanting to create quick and useful links to Wikipedia. Obviously, you could add a link manually each time, but wouldn’t an automated system be so much better?

Well, crack open your functions.php file within your theme folder and add the following code.

Then, simply add the shortcode  wikilink around any word/words that you wish to look up on Wikipedia.

For example….

The [wikilink]HTC Hero[/wikilink] runs the [wikilink]Android operating system[/wikilink].

This would then produce the following output…

The HTC Hero runs the Android operating system.

The links open in new windows (i.e. target=_blank) and I’ve set rel=nofollow – obviously you can change the above code to modify any of this.


One Comments

  • Rob

    26th August 2011

    Awesome tip, just added it to my blog. The only downside is being careful you don’t link a piece of text that doesn’t have a wikipedia article! Really handy though.

    Reply

Talk to me!