Ma.gnolia Etc.: Plugin for WordPress
Awhile back, I started using ma.gnolia to store my bookmarks online. I soon discovered that the site provides a code snippet you can insert into your WordPress templates that will display as many of your links as you like. Cool!
But it was a bit of javascript, and control over the exact output was limited and restrictive. Still, it wasn’t so bad, and I’ve been using it for several months now. What I really wanted, though, was a plugin for WordPress. Plugins are easy to use and usually easy to modify.
Quite recently, I discovered that just such a plugin has been created. I immediately downloaded it and immediately forgot about it. Until today. I took it for a test ride, and found it to be very simple to use. It was almost exactly what I had been wanting.
However, it was also outputting the links in a way that I didn’t like. Specifically, it was wrapping a DIV around the list of links. There’s nothing wrong with that, except that I didn’t want that. I just wanted a simple UL, and I wanted to be able to control via the function’s parameters whether or not to include the wrapper.
Fortunately, Barry Price, the author of this plugin, wrote it so that it is easy to modify. And that’s exactly what I did. I preserved the output as he wrote it, wrapper and all, while adding a parameter that allows you to specify if the output is meant to stand alone (i.e., use the wrapper) or not.
For clarity, I have renamed the modified plugin and function name. The only thing I have not done is add the ability to display the byline of the links, which the original javascript snippet from ma.gnolia did enable. Time allowing, I’ll add that later.
To use the ma.gnolia etc plugin, just insert the a call to the
magnoliaEtc('strUsername',blnStandalone,intNumberOfLinks)
into your WordPress template, where
- strUsername is your ma.gnolia username,
- blnStandalone is either true or false (true to include the wrapper, false to omit it), and
- intNumberOfLinks indicates the number of links to display (this parameter is optional; omitting it will display 10 linnks).
So to use this function to display your five latest ma.gnolia links, simply insert it into your template:
< ?php magnoliaEtc('username',true,5); ?>
That’s all there is to it.
- Download ma.gnolia etc v1.0 (8k) plugin for WordPress.
- Installation: Unzip and place folder in your WordPress plugins directory.
- Be sure to activate the plugin.
The original plugin by Barry Price is available here.
August 7th, 2006 at 5:19 pm
Aha, nice work.
You’ve pre-empted a few bits of my planned improvents for v1.1 there.
Fancy combining the two? Doesn’t seem to make much sense having two separate plugins…
August 8th, 2006 at 11:25 am
Sorry, I ended up going ahead with 1.1 anyway:
http://www.barryprice.co.uk/archives/2006/08/08/magnolia-wordpress-plugin-11/
Let me know of any other ideas you have to improve on things :-)