WordPress Plugin Development

A few weeks ago I was commissioned to create a WordPress plugin for a client. This plugin needed to take a feed on news from my clients website and display it on their clients dashboards.

After a few searches of the WordPress directory, I couldn’t find anything suitable, to either use as as a complete tool, or as a base top develop on top of. As such, I decided that learning the basics of WordPress plugin development couldn’t be a bad thing. After all, I make my living developing websites and a large proportion of that is now WordPress sites.

After reading a few tutorials (One, Two, Three, Four) I managed to knock together an admin plugin to create a custom post type and a client plugin to read a JSON feed of the custom post type, into a widget on the dashboard. This was alright and worked for my client but I realised that there was still a whole in the WordPress directory for plugins to do this. This is when I decided that I’d re-write the plugins and publish them in the WordPress directory.

I played around a bit and seemed to spend a lot of time on Stackoverflow researching the best practices of plugin design. In the end, I went with two OOP plugins. Again, one for the admin side, this time with a settings menu, letting you choose how many posts to show to your clients and the name that will show up on the dashboard widget:


and also one for the client side. This has a settings menu allowing you to point the request at your parent site, supplying the feed!


Below is the widget on a test dashboard:



Although fairly simple, I feel it’s taught me a fair bit about plugin development and has allowed me to progress my WordPress knowledge, something I know I can always improve upon.

For anyone that’s wondering, you can find the Admin plugin at: https://wordpress.org/plugins/dashboard-custom-feed-admin/  and I will update this post with the client side plugin as soon as it’s through review and into the WordPress directory here is the client plugin https://wordpress.org/plugins/dashboard-custom-feed/.

Jumping into open source – Gulp-Email-Creator

Until now, I’ve only ever dipped my toe into the open source community, adding issues there, commenting here, maybe making the odd pull request. Today, I decided to jump in and whether anything will come of it, I don’t have a clue.

I was sat around tonight thinking about making up some HTML emails, whilst thinking about it, I realised how bad my workflow around this is, currently I do the following:

  1. Create HTML templates
  2. Write SCSS and compile into CSS
  3. When happy with HTML and CSS, add CSS into <style> tags inside the HTML
  4. Take this updated HTML and CSS file and run it through Mailchimps CSS Inliner tool

This seems awfully long winded and awkward just to create some HTML with inline CSS. Then today, whilst exploring Github, I stumbled across Lee Munroe’s grunt-email-design repository. This got me thinking, if there is something like this for Grunt, then there must be for Gulp, my task runner of choice. After a bit of Googling around, I couldn’t find anything that was documented or that looked near a usable state, so I thought why not have a go? The worst that could happen is that it’s a failure and even I don’t use it.

With that, I started on Gulp-Email-Creator. Version 1.0.0 is now up on GitHub and available for people to use/hack/contribute to. It seems to work quite well and has shortened my HTML email workflow from the above to:

  1. Create email templates
  2. Write SCSS
  3. Grab compiled file with inline CSS

Just for a bit of workflow speed, I added livereload. A colleague at work got me using it not long ago and I must say, I’ve found it amazingly useful since.

Anyway, I think that’s about it. Go check out the repository and let me know your thoughts!

Hello, world!

So I’ve just put this site live while I sit here waiting for a mate to arrive. Hopefully I’ll get round to blogging a lot more now, I keep meaning to but always forget somehow.

As of Monday, I get to jump into a four month project, re-building a booking system which should be interesting. I expect I’ll write about my progress and any cool tricks I find along the way.

Anyway, I’ve got a meeting with a frying pan and some bacon. Cheers!