I’ve been using WordPress since 2005, hacking themes since 2008, and doing a whole lot more since then.. yet I have never written a plugin. All of my custom code has been done in theme templates and functions.php files

Well, now I have done so, without spilling much blood.

This is also the first time I have written something with a proper PHP class.

I do find it worth noting that I rarely get my answer in a single tutorial, I have to mix and match (and discard often).

Do not get to excited, this is not very exciting. And I bet Martin Hawksey has already done something way more elaborate.

The folks I am working with on DML Commons are doing some research on the interactions and were looking for some data from the blog syndication. I’ve looked at a smattering of WordPress stats tools, and they all are like log data, and are presented only to the admin side. I was thinking there might be something that does slick charts and graphs and stuff for the public side (I bet there is, one cannot find everything out there).

But there was nothing even I could find that would give them some basic data by category for the syndicated posts (things brought into the blog hub via Feed WordPress). My first effort was to do a one off custom script that generated the following in CSV format:

post ID

source indicated (either ‘local’ or ‘syndicated’)

post title

publication date and time

author name (first and last name from profile, this is added to user profiles via the gravity form signup thing I built)

I set up a duplicate of the site on a dev server, and sent them a few links to export the data for the two different strands, Professional PathWays and Design Research (because of the syndication design, these posts get put into categories). This was supposed to be just a test of the functionality.

They said, “thanks this is perfect!”

Hmmm.

I really need to start rolling some of my things into plugins so they can be use elsewhere w/o needing the theme hacking.

So in a few hours this morning I got a working plugin, now a very alpha version on github as Export Post Data to CSV. When activated, it adds a Post CSV Export item to the WordPress Tools menu. Nothing sophisticated:

My big fat plugin

You can choose to export data on all posts, or from within a category. The wp_dropdown_categories() function is handy as it can generate the menu, including an item for All Categories, keeping the category hierarchy, and even including a post count. I have it running here on my blog:

I do not know how helpful this kind of data per post is. Ideally we’d like to cross it by time maybe with twitter data. What else might there be worth extracting from posts? I can already see that I could get tags and categories.

This on its own is not big, but now I have the method started. For the upcoming #vcubrb projects, I am hoping to roll into a plugin a lot of the functionality I have been hand coding into the Feed WordPress sites I have been building. This way we could potentially make it easier for people to create a Connected Course. I can see having:

A Shortcode for adding a user sign up form, without needing gravity forms (including the logic to add the data to Feed WordPress directly

The Shortcodes I use for generating the blog lists

A script to generate OPML feeds for categories of blogs

But at least now I have grown up, written a plugin, and can shave like a big boy.

I’m in that same world (nothing shipped yet but plans….plans everywhere!). I’ve found Pippin’s Plugins to be essential https://pippinsplugins.com/. Cheap to support his work and the content is extremely accessible to novices like me that have a basic understanding of WordPress and are ready to dive in with plugin development. I’m working my way through his 101 series these next few weeks. https://pippinsplugins.com/series/plugin-development-101/