A little while ago I got a job doing some web development for a history website, that was basically going to be listing a bunch of different historically significant news articles, publications, pictures, letters, etc, according to the Canadian standard for.. documenting this stuff, I guess. Anyways, it was decided that WordPress would be the best approach, since it already contains many things the people wanted for this website, such as searching, posting individual items (posts), commenting/addition of notes to items, and the handy dandy admin panel.
So, it was my job to go searching around figuring out how we were going to be able to “attach” about 25 extra columns of data to these entries. Each item (post, entry, w/e) was going to have all the same fields in them. I searched around for quite a while for a plugin that could do something like this, but didn’t find anything suitable.
I mean, sure, there were plugins that added extra fields to the posting page, but the problem was they just added the data to the metadata table. And have you seen that table? It’s not suitable at ALL for storing 1000+ posts containing the same 25 different fields of data. It’s laid out somewhat like this:
| ID | post_id | key | value |
| 1 | 1 | monkey | a |
| 2 | 1 | banana | b |
| 3 | 2 | monkey | c |
| 4 | 2 | banana | d |
| 5 | 3 | monkey | e |
OK, so, now make each post actually have 25 different things (not just two like in the example above) and repeat 1000 times (literally). That’s not going to look very nice at the end of all that, is it, especially if they ever want to export that data from the mysql table. For normal uses, like the every day average blog, where it doesn’t really matter how the data is stored, that’s A-OK. But in this case, it definitely wasn’t what I needed. I needed a seperate table that contained columns of whatever the hell I wanted
I needed something more like this:
| item_id | post_id | monkey | banana |
| 1 | 1 | a | b |
| 2 | 2 | c | d |
| 3 | 3 | e | f |
Which, as you can hopefully see, is far cleaner.
But, no one seemed to have made anything like this (Well, I’m sure somewhere out there someone has, but I couldn’t find one that was suitable). So, I decided to dive into the unexplored depths (unexplored for me) of wordpress plugins, excepting some kind of monster to appear and slap me a few times before I finally figured it out and strung together some half working thing that could be called a plugin if you only used it in a very specific way.
I’ve had this grudge against wordpress for a while, and I don’t really know why. Actually, I’ve had a grudge against any software on the web that does stuff for me. I used to make my own blog “software” (one actually turning out OK), and my own forum software, because I couldn’t stand using someone else’s. I think it’s kind of like I wanted to be cool, you know, making my own stuff, feeling that these engines were too full of extra crap to make their functionality and ease useful.
The last little while though, as I’ve dived into wordpress more and more, that’s definitely changed. From the admin panel alone, it feels like something that’s over complicated and full of junk I don’t need. This, is false. As I was reading page after page on their wonderful codex, ripping apart their source code and going through parts I probably don’t even need to explore, I realized that the software was built quite well. The organization seemed really great, and I loved how the plugins worked. The Actions/Hook idea is brilliant, high-five with whoever came up with that. It’s something I hadn’t considered before, but once I figured it out, I had my plugin done in a mere 2-4 hours.
The actions/hooks allow you to, essentially, stick your code in wherever you like, without actually modifying any of the original code. You can say “when someone saves a post, run my function”, or “when the admin logs in, run this function”, or “when the admin page loads, also load my plugin settings navigation”. It’s so smooth and easy to use.
So, my expectations with Word Press were low, not going to lie. I knew it had a lot of awesome functionality, but I thought it was a beast that had been worked on to the point where stuff was overflowing. And yes, it does have a lot of functionality, but nothing’s overflowing, it’s kept organized, clean, and everything is just right. It’s not too built up to make it hard for plugins/themes to work, and also not empty enough to make plugins have to do all the work.
So, that’s my adventures with wordpress, for the moment. I’m actually not totally done my plugin yet, I have to make a full “preview” of it in action for next Monday, so that’s going to take a bit more work (on the theme + plugin), but I think it will be a pretty smooth ride.


