Wordpress Logo

WordPress plugin: Wikipedia extract tooltip

Posted by

I’ve never written a WordPress plugin before and was surprised how simple it was. I have knocked up a plugin based on Altreus’s Protip to allow an abstract from Wikipedia to be pulled into a WordPress post using a simple shortcode. Version 1.0 is pretty rough and ready and doesn’t support any amount of customization. Regardless, it seems to work on the basic test cases I threw at it and any bug fixes/examples of where it doesn’t work would be appreciated so I may tweak it.

It’s not overly reliable because it has to parse Wikipedia’s markup since the API is fairly useless but no doubt it’ll improve as non-working cases are found.

Examples below:

Pink Floyd are known to have loved sausages – especially when they visited Disney World in Florida. Furthermore, the cat sat on the mat.

Source code can be downloaded here. Just unzip the archive into your wp-content/plugins folder and activate in the plugin manager. Then use the [wiki] shortcode to get the tooltip – e.g. [wiki]Pink Floyd[/wiki].

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *