Daryll Doyle WordPress Development and Consultancy in Cornwall

WordPress Plugin Development

W

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:

screenshot-1

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!

screenshot-1

Below is the widget on a test dashboard:

screenshot-2

 

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/.

About the author

Daryll Doyle

Daryll is a Lead Web Engineer at 10up.

He is the original author of the SVG sanitisation plugin Safe SVG, which has over 500,000 installs from the WordPress.org plugin directory and is now maintained by 10up.

He has also spoken publicly about SVGs and WordPress, including a talk at WordCamp London 2018.

In his spare time he enjoys spending time with his family and researching Developer Experience.

Add comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Daryll Doyle WordPress Development and Consultancy in Cornwall