While I certainly believe it’s useful to post snippets and tutorials showing pieces of code (obviously, since that’s a lot of this blog), I’ve also realized that it’s kind of hard to get a feel for what the actual coding process looks like. For my process, especially for experimental “side projects,” that means a lot of fits and starts and errors and mess en route to something that actually does what I want it to do.
I feel like that’s the part that’s missing a lot of the time in tutorials – that mess part – and it leads newer coders to think that if they’re having that experience they’re Doing It Wrong.
Silliness, since the mucking around is actually the best part (the one that leads to the rush when the muck cleans up into something that solves an actual problem).
So that’s what this series is about – I’ll follow my working process through a WordPress plugin I’ve been meaning to write, keeping the code public on GitHub and blogging about what I’m trying and learning and getting wrong along the way.
Project at a Glance
What are you building?
A super useful WordPress plugin that generates developer-focused reports about the site it’s installed on.
Which languages will you use?
PHP, WordPress lingo, HTML, CSS, probably some jQuery…
Where’s the code?
On Github! Or, at least, it will be soon.
A Bit More Project Background
There are lots of points in various types of projects where it would be super helpful to have a quick data dump of the status of the WordPress installation – things like the version of WordPress, a list of the installed themes, and some information about the installed plugins.
For plugins specifically, it’d be great to know all the active and inactive plugins, including version numbers and whether. For both plugins and themes it would be helpful to know if they’re all up to date or if they’re a version (or more) behind.
All this data would be great both for troubleshooting and for keeping on record when starting a site rebuild or launching a project.
Unfortunately, there’s no super easy to do it right now (that I know of), other than maybe grabbing screenshots of a few admin pages or dumping some raw data from the site’s database.
The General Approach
I’ve written a couple very small WordPress plugins, mainly those that add little pieces of content via widget and/or shortcode. I’ve never written a fully admin-focused plugin, nor have I ever tried to interact with data about the site itself (rather than post/ page data), so I’m not quite sure how this will work out.
My wish list for this plugin is that it will:
- Have a nice, simple options/ admin UI
- Allow the user to generate (view) and download reports, probably in multiple formats (TXT, PDF, maybe HTML?)
- Allow the user to include a few different data points/ sets in the reports, including the following:
- Date and time the report is generated
- The current version of WordPress and whether it’s the latest version (or if not, what the latest version number is)
- Lists of active and inactive plugins
- For each plugin, name, author, URI, version number, and whether it’s up to date or not
- List of themes with indicator for currently active theme
- For each theme, name, author, URI, version number, and whether it’s up to date
- Also these things would be nice:
- Generator info about the plugin itself, sort of like a credit or info block about how the report was created
- Generator info about the person generating it, if they want to include their business info because they’re generating it for a client, for example
- Last updated info (about WordPress core, plugins, themes, maybe overall or in each area?)
- Maybe server/ host information? PHP version, that sort of thing?
A few resources I’ve got my eye on include:
- This HTML5 PDF Generator tutorial
- The Codex page on the
- This reference list of reminders for plugin developers from Smashing Magazine
- There are also a couple of existing plugins that list your plugins in a post or page via shortcode that may have useful info in them
Since client work comes first, I don’t have a set timetable for this project. I’ll track the code in real time via the GitHub repository, and I’m hoping to update roughly weekly here, writing about tweaks and code changes I’ve made and what I’ve learned along the way.
Next week, I’ll post about setting up the repository and some initial code setup in the main plugin php file. From there it’ll be a little more haphazard as I tackle various pieces of functionality.
I would love to have you contribute to this project in any way you’re able. Even if (especially if!) you’ve never contributed to this type of project before – this is a safe place to start.
Maybe it’s brainstorming features or coming up with an organizational structure/ UI for the reports, or researching and linking to potentially relevant functions or code snippets. Or, testing code, finding issues and bugs, and reporting them via GitHub once the issue tracker is set up there.
Anything and everything is welcome!