2019 year in review

I’m a bit late to the party here, but rather late than never right?

This is going to be a shorter “year in review” post than I usually write. The reason being that 2019 was not a good year in many ways for me. I’d rather not get in to all the details, but I’ll summarize and finish with some of my plans for 2020.

What didn’t go well in 2019

At the start of 2019, I had a lot of enthusiasm for the year ahead. I had great plans to start my YouTube channel again and spend more time working on some of my side projects and ideas that I had. None of that happened.

Early on in the year, my father passed away in the UK. 2 weeks later, my step father passed away. And then about a month later, my grandfather passed away. That pretty much set the tone for the rest of the year.

Work wise, I felt stagnant. I also had little motivation for side projects. I tried a few things, but lacked focus and pretty much all things fizzled out.

I half jokingly say, the best part of 2019 was that it ended (apart from one major event detailed below).

What went right in 2019

On the 5th of March 2019, my 3rd child and second daughter, Lucy-Mae Karly Geri was born. She was most definitely the silver-lining of an otherwise horrible year.

Moving forward in 2020

I feel that in some ways I am still recovering from 2019, but I’m optimistic! This year I’m intentionally trying to slow down, but at the same time, I’m going to be expending focused effort on things that I’m passionate about.

I’ll be writing more about those things during the course of the year. They include adventuring the outdoors, building a software business side hustle and working on my health.

Life update, finding passion again

Software development has been a massive part of my life since my very early teenage years. I’ve got vivid memories of writing my first pieces code and the sense on accomplishment that came with that. I recall spending hours upon hours in my bedroom as a teenager, hunched behind the computer, learning to write code.

During those early years, I never really considered that it would, or even could, become a career for me. I really only did it because I loved doing it.

When I finished high school, I knew that college wasn’t something that I wanted for myself. I hated school and studying. Even though the expectations of my parents were that I should go to college, I had an entrepreneurial spirit in me that I couldn’t shake and it of course didn’t help that I really, really did not want to study. I was 18 and the world was my oyster.

I ended up taking multiple internships, volunteered at a school for the underprivileged twice and started a few small online business that never really had much traction. Until I started doing freelance software development work and began to use the skills that I had taught myself through the years to build websites, apps and software for various clients.

In a way it was a perfect synergy between my passion and entrepreneurial spirit.

It’s now been almost 20 years since I started coding for fun and I’ve mostly freelanced, consulted and had 1 full time corporate style job in-between. Software development has been very good to me and enabled me to live a very comfortable lifestyle and give my family the same.

The problem is, that it has also completely burned me out. I’ve spoken about this in a few different places before and I’m not going to get in to the details in this post. The point is just that after 20 years of sitting behind a computer screen almost every day, and in more recent times, working on extremely challenging projects and tight deadlines, I’ve in some ways reached breaking point.

What I did wrong that lead me to burn out

It’s hard for me to answer why I burned out. I’m sure there are a few different reasons as to how I got to this point, both things that I did consciously and sub-consciously.

If I had to pen a few things down that I feel contributed to the burn out, they’d be:

  • I’ve got a personality that struggles to settle and is always wanting to achieve and do more
  • I spent time outside of work behind the computer, doing – you guessed it – software development behind a computer
  • I was trying to build a side-hustle doing software development content on this site and YouTube when I should have been as far away from a computer as I could get
  • I took on too much
  • I put myself in to work situations (usually for good intentions) that I shouldn’t have got it to – that corporate j0b? Bleh!
  • I didn’t spend time doing the things that I love to do, outside of work.

Of course in hindsight, it’s easy to say I should have done this or that, the reality is that I’m in a situation that only I can work my way out of.

Where to from here?

Do I plan on stopping to code? Absolutely not. I’ve got a family to support and bills to pay. That would be extremely silly of me to do. And I still have a passion for the software development work that I do, it just needs to be confined.

And that’s the key. Limiting the time I spend behind the computer to only work and passion projects outside of writing code.

I’ve got many other passions that I really enjoy that I just end up not doing. Either because I’m caught up in work or trying to do something on the side and have no time. I end up ignoring the things that actually feed my energy and creativity and bring me deep happiness.

What that means for this blog is that it’s no longer going to be a blog just about software development. You may have already noticed my blog post yesterday about how to plant a tree 😉 I’m going to be writing way more frequently on this blog (as writing is one of those things I really enjoy doing) but about a much more diverse set of topics. Most of the posts will fall in to the categories of outdoor adventures, DIY, business, getting fit and healthy, personal development and of course I will still be writing on topics related to software development.

I realize that many of the subscribers to my blog come here for the software development topics and that writing about more diverse topics may turn them away, but the point of this blog, as a personal blog, is to write about things that interest me.

As for my YouTube channel, it’s growing even though I’ve done very little on it. I will be leaving up the videos and tutorials I’ve done in the past. I’m toying with the idea of starting the channel up again, but for mostly non-development related content. Just as a creative outlet for things that excite me, which will mostly be outside the realm of software development.

Finishing the year strongly

Lastly, many of you don’t know, but this year has been incredibly difficult for myself and for my family. By the time May came around, I had lost my father, stepfather and grandfather. I’ve also had very high levels of stress at different times this year and have felt quite directionless in terms of what I’m trying to achieve in many areas.

In situations like this, it’s easy to feel out of control and just let life happen. Heck, I’ve done a lot of that this year. But the better approach to take is to start being intentional about fixing things. I finally feel like I’m in a space where I am ready to start being intentional. First up, is my health! My health is something I’ve neglected heavily for far too long a time. I’ve recently started eating right and exercising again and will soon write some posts about what I’m eating and working out on.

I’m looking forward to ending this year on a good note and if you’re interested, stay along for the journey by subscribing to my blog.

How to plant a tree

I’m by no stretch of the imagination a professional gardener or a “how to plant a tree” zen master, but you could definitely say that I was born with green fingers. There’s something about the sun, dirt, greenery and growth that tickles my fingertips. But I digress!

Today was arbor day here in sunny Cape Town, and what a peach of a day it was. Arbor day of course means it’s time to plant trees (you did plant a tree today right?). It also meant that our local garden centre was offering a free tree sapling when you purchased a bag of compost from them. Well sweet deal! I gathered some “friends” and managed to score 4 trees and save a whole lot of money at the same time. Shhh, let’s keep that our secret 😉

Naturally, these trees had to be planted, and planted they were! It’s not the first time I’ve planted a tree, but it’s the first time I planted a tree and actually researched the correct way how to plant a tree. And so, I now get to share what I learned so that you can successfully plant a tree too. This is my guide to planting trees (mostly so that next year I can look this post up and plant more trees the correct way).

Step 1: Pick the right tree to plant

So, to start off with, you need to pick a tree that suits your requirements. A good question to ask is why are you planting the tree? There are multiple different reasons for planting a tree from aesthetics, to attracting bird life, privacy and more. What’s yours?

You should also think about whether you want an evergreen tree, a fast or slow growth tree, the type of soil you’ll be planting the tree in (is it sandy or more like clay?).

Once you’ve identified the why, now comes the hard part. You need to research the different types of trees that fit your requirements. Unfortunately, I can’t do this for you. There are over 60000 different species of trees on earth and depending on where you’re reading this from, and your “why” as we talked about above, you’re going to have to put in the hard yards (i.e. Google it) and figure out what tree to plant.

Personally, I wanted to plant a row of trees in front on my property’s perimeter wall. I wanted it to look good all year round, so evergreen and tall, and it needed to be a medium to fast grower, especially because I am planting them from saplings! The soil outside my house is quite sandy and the tree needed to be ok with this kind of soil. One last requirement was a tree with a non-invasive root system. The row of trees would be planted outside amongst fibre tunneling and street light cables.

I went for Syzygium Guineese trees, also known as a Water Pear.

Oh and don’t forget when actually purchasing the tree to look for:

  • No signs of disease or critters on the tree and leaves
  • Strong and sturdy trunk and developed lower branches
Preparing to plant a tree
Even Grishko is chuffed with our loot from the garden centre

Step 2: Get the right tools

Ahh yes, as they say, don’t take a knife to a gun fight. Having the right garden tools to plant your tree is essential. Brush over this section at your own peril and don’t blame me sore backs, nasty cuts and your better half angry at you for dropping F-bombs – you’re the one sleeping in the shed tonight, not me.

The good news is that you don’t need many tools to plant a tree. I’ll make this easy for you and give you a list of the tools you’ll need:

  • Spade/Shovel
  • Scissors
  • Boots
  • Gloves

Picking the right spade/shovel

You need to get the RIGHT shovel/spade. Straight up the most important thing you’ll need is a shovel. Sounds simple right? Well it mostly is, but depending on the type of soil you are planning to dig up, you should have the right shovel or spade.

The short and sweet version of selecting the right shovel is, if you’re digging to soft dirt you most likely will want a pointed tip shovel. There won’t really be a need to a step ledge or even a D grip at the end of the shovel.

If your ground is hard however, you’ll want to go for a more heavy duty spade with a step ledge and D grip. I also prefer a square sharp end to my spades. The combination of these features will allow you to easily sink the spade in to the ground using your boot and D grip to get the spade nice and deep.

I really should not be wearing those flip-flops

Scissors, boots and gloves

Sharp scissors will allow you to easily cut open the plastic pot or bag that your tree is in (be careful not to cut the roots!). Boots will save your feet from nasty gashes – trust me on this one, I tried planting my trees with flip-flops today and it did not end well for the sole of my right foot. And then gloves will protect your hands from sharp objects and critters beneath the surface – again trust me as I didn’t take my own advice here and got a nice cut on my left hand from an old rusty tin can.

Step 3: Dig the hole and prepare the soil

Finally, on to the fun part! It’s time to dig the hole and treat the soil for healthier growth than a green salad. Time to dig. “Hi-ho, hi-ho, it’s off to wor…” – not so fast! Before we start digging…

How large should you dig the hole?

An extremely important part of planting and growing a healthy tree is the size of the hole you dig. The general rule of thumb is:

  • 2-3 times the width or circumference of the root ball (the root ball is basically what comes out of the package when you remove it from the tree – took me a while to figure that one out, don’t ask!)
  • Then when it comes to depth, don’t dig too deep! You want the top of the root ball to be level with the ground (or even just above it). Going too deep will deprive the roots of much needed oxygen and this will stunt growth.

When planting my trees today, I messed this up a bit. I should have dug a wider hole, but hey! I live and learn. Mistakes are ok, just learn from mine 😉

Digging the actual hole

It goes without saying, avoid any underground pipes, tunnels, plumbing, utilities etc! If you’re planting outside your boundary line, like I was, it sometimes helps to get a hold of the city or fibre company and ask where their lines are laying.

Start digging! What I did, and it is generally recommended, is as you start digging, create 2 piles of dirt either side of the hole (I’ll explain this in the next section). Dig the correct width and depth and once done, move on to the next step.

How to plant a tree - digging the hole
Digging the hole for the tree

Step 4: Plant the tree and mulch the surface

Ok, now we are really talking. Let’s get this tree planted. At this point we need a few more materials:

  • Compost
  • Bone meal
  • Mulch

Got all of those? No? Seriously, go get them if you care about the growth of your tree as much as you care about chocolate.

Now, remember those two piles of dirt next to the hole you dug? Great, mix a 50:50 ratio of compost to the dirt in both piles. One part dirt, one part compost. Once that is done, take a handful of bone meal and mix in to one of the piles.

Should you use fertilizer when planting a tree?

Before we go any further, I’ve just advocated using an organic fertilizer (bone meal) when planting your trees. Is this a requirement?

Well, I’m as much a scientist as I am a professional gardener, but again I’ve done some research here! Not surprised are you?

The short of it is that yes, you should but in different types and amounts depending on the age of the tree. Here is a rough guide to fertilizing a newly planted tree.

  • Tree’s that are young (like my saplings) and newly planted should be fertilized with a slow release fertilizer (i.e. bone meal) and low nitrogen. Nitrogen can burn the roots of a sapling so be careful with fast-releasing fertilizers.
  • When a tree is older and well on it’s way to becoming a “three-nager”, you can up the rate of fertilization. It’s actually even recommended that you do. I’ll write a post in the future when my trees grow bigger about fertilization at that stage.

What is bone meal?

For those of you who are curious 😉 Bone meal is simply ground up animal bones. It’s mostly used to increase phosphorus and has a NPK value of roughly 3:15:0. As you can see, it contains nitrogen as well. It’s a pure organic fertilizer and has a slow release since it needs to be decomposed by microorganisms underground.

Placing the tree and compacting

Let’s get planting. Start off with throwing some of the bone meal mixed soil at the bottom of the hole.

Carefully cut away the packaging of the tree from the root ball (as before, try not to cut the roots). Massage the tree out of the packaging and look for any circling roots. Untangle and straighten these roots carefully.

Now place the tree in the middle of the hole. Keep it upright and straight (remember to look at it from all angles) and check the height is correct. Too deep? Add some more bone meal soil mix.

Add the bone meal mix around the root ball until it’s finished and then start adding the other pile of soil. As you add the soil, compact it so that you remove any air which could dry out your roots. This will of course also stabilize the tree. Add soil until the ground is level.

You may want to now create a wall around the hole in the form of a basin to retain water. Additionally, add the mulch. Remember though, not too much mulch! And keep the mulch away from the base of the tree.

Step 5: Water the tree

Lastly, you need to get that tree wet. After first planting you want to give your tree a decent amount of water. I filled up a large bucket and gave each tree a bucket of water.

Congratulations! You now have a planted tree that should show strong and healthy growth!

Watering the tree
Watering one of the newly planted trees

Step 6: Maintain the tree to encourage growth

The fun doesn’t stop here. Maintaining the tree and watching it grow is very rewarding. For the most part, maintenance really comes down to watering it correctly.

The amount of water your tree will need depends on your location and weather. In hot, sunny and dry climates, you’re going to need to water your tree more often.

Spend a couple of weeks observing the tree and its water needs. Adjust based on climate and rainfall and always make sure you’re giving it the water it needs.

Again, as the trees I planted today grow and I learn to maintain them, I’ll write more about the process. So keep your eyes out for those posts.

The world needs more trees, so keep on planting!

Row of newly planted trees
Grow young saplings, grow

Quiet desperation

This video resonated with my profoundly. So much so that I try to watch it back at least once a week.

As I’ve got older and life’s responsibilities have become greater, lifestyle creep has crept and things have become far more expensive, it’s become a lot harder to live a life that I used to dream of growing up. It’s harder to do and achieve the things that I set my heart on as a young man.

And so there are two paths that I can take at this point in time, the safe path or the dangerous path.

What ever you are doing, do it like your life depends on it.

Joe Rogan

Why I stopped writing

Almost 3 years ago I wrote an article that made me stop writing completely. I’ve never really told this story to anyone before.

Up until I published that article, I’d been writing weekly about WordPress development and industry related issues.

Since then I’ve posted 3 snippet type blog posts, but I stopped writing anything meaningful and the passion was gone.

The article that I wrote on that day got a ton of attention. It spread quickly through the WordPress community and was read by many peers.

Up until the point where I published that article, I was really confident in what I was writing.

I was publishing some interesting articles and many of them were somewhat controversial in that they drew some negative feedback from what I’d refer to as important people in the WordPress community. If you’ve been in WordPress development for even a short period of time, you’d know their names.

I was ok with it though.

I put on a hard face and defended my opinion in the best way possible. In some instances I had my mind and opinion changed through debate and discussion.

And then, that article.

I don’t know what it was about that article.

Maybe the chatroom that I found through my analytics were I was ridiculed by people I really respected.

Maybe the fact that they were trying to tear apart an open source project of mine because they didn’t like the article.

Maybe it was the one time commenters who leave negative comments and don’t come back to finish a discussion.

Maybe I was just tired of constantly having to deal with people trying to break me down.

And so I just stopped writing. I stopped sharing my opinions. I stopped exposing some of my insecurities and even naivety through my writing. Because the feedback was eventually too much to take.

I hear and have seen in some cases, that a lot of the development community works this way. Someone floats and idea through an article, pull request or tweet and if it’s not agreed with by some, the attacks start.

Instead of talking, showing empathy and teaching, names are called, expletives are used and people are broken down. It’s been said before, the anonymity that the internet provides brings out the very worst in people.

Inside, I feel even more vulnerable than before. It’s been a tough few years and I’ve lost a lot of confidence. I know though, the only way to grow stronger is to keep moving forward. To keep writing and sharing my ideas and thoughts.

And even though there are more trolls than before who want to break me down, I care a lot more about the many people who’ve emailed, Slacked, commented and shown appreciation for my writing and how it’s been valuable to them. They’re the reason why I’m back and I can’t wait to start sharing more.

2018 year in review

It’s hard for me to characterize the past year, in fact the past 3 years since it’s been that long since I did one of these updates. The start of 2016 started exceptionally well for me and up until speaking at WCEU 2016, things were really, really good.

Without getting into too much detail, that’s a story for another blog post, things culminated in a really difficult end of 2018. It was a tough year for me but there were a few highs worth noting. We’ll start with some of the lows though and end on a more positive note.

What didn’t go well in 2018

I didn’t blog or produce any video content. I went from an extreme content high in early 2016 to not doing anything since mid-2016. While this doesn’t sound like a big deal to many, producing content deeply satisfies me and fulfills what I believe to be a big part of my answer to the question that I continually seek to answer, “what I am here for?”.

Next, I took on side-projects and hustles that were not aligned to what I believe to be my true purpose in life. I need to constantly remind myself that I should not take on projects just to make a buck. I’ve learned that to be truly satisfied in my work, I have to be making a difference in peoples lives. These side-projects and hustles just added to the stress that I was already under.

Professionally, I don’t feel like I’ve grown much at all. I didn’t take opportunities that were up for grabs and I didn’t apply myself in areas that I wanted to grow in. I coasted along and while I worked hard, I didn’t work in the right areas.

And all the above led to an extreme bout of burnout towards the end of this year. After an extremely hectic project, I crashed. I’ve experienced burnt out before (see my 2015 update) and this time was just as difficult.

What went right in 2018

The highlight of my year professionally was leading the backend development of the RollingStone.com rebuild. There were some extremely challenging pieces to this rebuild and migration, but it all came through superbly in the end.

On a personal level, Megg and I bought a new house in Cape Town. Since moving to Cape Town in 2016, we had been renting until we found the right place to buy. In February, we signed an offer to purchase and we’re now living happily in our new home. Megg is also pregnant with our 3rd child! We’re expecting a baby girl in March. I’m still not convinced that Cape Town is our final destination, but it’s home for now.

Most importantly for my own wellbeing, I feel mostly recovered from the burnout. I’m so excited to start writing more in 2019 and producing YouTube tutorial videos again. I’m focused on aligning my work to what I call my True North or life calling and I’m ready to make 2019 my best year yet.

Some stats (for fun)

A year end review post is not complete without stats! Here’s some key metrics I like to measure – values in brackets are last years figures.

Blog stats

YouTube stats

  • Videos released – 0 (0)
  • Total views – 82100 (96600)
  • Minutes watched – 183900 (237700)

Subscriber stats

  • YouTube subscribers – 1580 (1284)
  • Email subscribers – 456 (417)
  • Twitter followers – 945 (?)
  • Facebook page likes – 224 (224)


  • Countries visited 2 (USA, Spain)

Moving forward in 2019

Overall, I suppose the past year (or years) can be characterized as a rollercoaster. I’m sure 2019 will bring it’s own set of challenges, but my hope is that by being true to what I believe to be my current purpose in life, I’ll do more meaningful work and be happier for it. Let the fun begin…

Add Custom Post Types to Zoninator

Zoninator is an simple plugin for being able to curate content on a WordPress website. While I personally feel that more can be done in WordPress when it comes to curation of content, Zoninator ticks most boxes of a simple to use and easy to implement curation solution.

By default, Zoninator only lets you select posts when selecting content for a specific zone that has been created. That’s all good and well, but what about when you want to select a piece of content that is filed under a Custom Post Type?

Turn’s out, you need to enable support for zoninator when registering the custom post type. To do that, simply add zoninator_zones to the supports argument when registering the Custom Post Type

Add Zoninator support when registering a Custom Post Type

Here is an example snippet of a Custom Post Type that is registered and includes support for Zoninator.

add_action( 'init', 'codex_book_init' );

 * Register a book post type.
 * @link http://codex.wordpress.org/Function_Reference/register_post_type
function codex_book_init() {
	$labels = array(
		'name'               => _x( 'Books', 'post type general name', 'your-plugin-textdomain' ),
		'singular_name'      => _x( 'Book', 'post type singular name', 'your-plugin-textdomain' ),
		'menu_name'          => _x( 'Books', 'admin menu', 'your-plugin-textdomain' ),
		'name_admin_bar'     => _x( 'Book', 'add new on admin bar', 'your-plugin-textdomain' ),
		'add_new'            => _x( 'Add New', 'book', 'your-plugin-textdomain' ),
		'add_new_item'       => __( 'Add New Book', 'your-plugin-textdomain' ),
		'new_item'           => __( 'New Book', 'your-plugin-textdomain' ),
		'edit_item'          => __( 'Edit Book', 'your-plugin-textdomain' ),
		'view_item'          => __( 'View Book', 'your-plugin-textdomain' ),
		'all_items'          => __( 'All Books', 'your-plugin-textdomain' ),
		'search_items'       => __( 'Search Books', 'your-plugin-textdomain' ),
		'parent_item_colon'  => __( 'Parent Books:', 'your-plugin-textdomain' ),
		'not_found'          => __( 'No books found.', 'your-plugin-textdomain' ),
		'not_found_in_trash' => __( 'No books found in Trash.', 'your-plugin-textdomain' )

	$args = array(
		'labels'             => $labels,
                'description'        => __( 'Description.', 'your-plugin-textdomain' ),
		'public'             => true,
		'publicly_queryable' => true,
		'show_ui'            => true,
		'show_in_menu'       => true,
		'query_var'          => true,
		'rewrite'            => array( 'slug' => 'book' ),
		'capability_type'    => 'post',
		'has_archive'        => true,
		'hierarchical'       => false,
		'menu_position'      => null,
		'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'zoninator_zones' )

	register_post_type( 'book', $args );

Again, the specific piece to take note of is the supports argument. There is another method to enable support for Custom Post Types. If you did not register the Custom Post Type yourself or you don’t have control over it in your code, you can use the add_post_type_support function.

Alternative Zoninator add post type support method

Simply call the following function (just make sure it’s called after the post type is registered). It’s also a good idea to use an action to fire off the function.

function mg_register_post_type_support() {
	// Zoninator on pages.
	add_post_type_support( 'page', 'zoninator_zones' );
add_action( 'after_setup_theme', 'mg_register_post_type_support' );

And there you have it. Two simple ways of adding Custom Post Type support for Zoninator.

Should you add actions or filters in your WordPress class constructor?

You may have heard that adding actions or filters to your WordPress class constructor is not a good idea when creating a theme or plugin. Yes?

Quick side note! Isn’t it annoying when someone mentions something isn’t a good idea, but doesn’t explain why? Yea I think so too.

So let me explain why and attempt to do it in a way that makes sense.

Essentially, there are two reasons why.

Why not to add actions and filters to your WordPress class constructor

  1. The role of the constructor
  2. Makes your unit testing, less unit-ty.

So first, the role of the constructor in PHP is to initialize your object’s properties. Everything else should be handled in the class methods. Is adding actions initializing the object? No it’s not since the actions (or filters for that matter), don’t do any initializing, they only hook in to WordPress and get called later during the WordPress execution.

Makes sense? No? Have a read of Carl Alexander’s article on plugin constructors – he has a knack of explaining things simply.

And the second reason, less unit-ty unit tests, probably isn’t so self explanatory. A unit test is meant to run in isolation and test the smallest unit of code. Most WordPress unit tests I’ve seen (and am guilty of writing) are actually more like integration tests as they test WordPress features and not class methods/units of code.

So if we’re writing pure unit tests, in the way they are intended to be written, and we add actions and filters to a constructor of a class in our plugin or theme, then we can’t test our code (or instantiate an object of a class), without WordPress and all the action/filters being applied. Yes, sometimes you may want them to be applied, but by only applying them in a separate method, you have the choice to load them if you want to by calling a method.

And if that didn’t make sense, check out Tom McFarlin’s article on the issue.

Now that all is said and done, I hope you have a better understanding of why you shouldn’t use actions and filters in your WordPress theme or plugin class constructors. Got questions? Hit me up in the comments below.

Display an Instagram feed on your WordPress website

Need to display an Instagram feed on your WordPress blog/site? Eaaassssyyy!

In this short little snippet, I’m going to show you how. I’ve done two different implementations of Instagram feeds on WordPress sites recently. The first one, was the display of a single users feed in the footer of a website. The second solution aggregated multiple different user feeds and showed the most recent images that were uploaded across the different feeds.

Today I’m going to share the first method, and then I will follow up this snippet with the aggregated solution in another snippet later this week.

Let’s dive in to the code first and then look at how it works…

WordPress Instagram Feed Snippet

 * Class used for fetching and displaying Instagram feeds.
 * License: GPLv2 or later
 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
 * WordPress Instagram Feed Class, Copyright 2017 Matt Geri
 * WordPress Instagram Feed Class is distributed under the terms
 * of the GNU GPL.
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.
 * @since 1.0
 * @package MattGeri

namespace MattGeri;

 * Class Instagram
 * @since 1.0
 * @package MattGeri
class Instagram {
	 * The transient key used to store the feed results.
	 * @since 1.0
	const TRANSIENT_KEY = 'instagram_feed_%s';

	 * When to expire the transient - set to an hour.
	 * @since 1.0
	const TRANSIENT_EXPIRE = 60 * 60 * 24;

	 * The Instagram endpoint for fetching images.
	 * @since 1.0
	const INSTAGRAM_API = 'https://www.instagram.com/%s/media';

	 * Display an unordered list of Instagram images for a given profile
	 * @since 0.1
	 * @param string $user The Instagram user id.
	public function display( $user ) {
		$instagram_feed = $this->fetch( $user );

		if ( ! is_wp_error( $instagram_feed ) && ! empty( $instagram_feed ) ) {
			<ul id="instagram">
				<?php foreach ( $instagram_feed as $image ) : ?>
					<li class="instagram-item">
						<a href="">
							<img src="" alt="" title="">
				<?php endforeach; ?>
		} else {
			esc_html_e( 'There was an error retrieving the Instagram feed', 'instagram' );

	 * Fetch and cache an Instagram feed for a given profile.
	 * @since 0.1
	 * @param string $user The Instagram user id.
	 * @return array|\WP_Error
	public function fetch( $user ) {
		$instagram_api = sprintf( self::INSTAGRAM_API, $user );
		$transient_key = sprintf( self::TRANSIENT_KEY, $user );

		if ( false === ( $instagram_feed = get_transient( $transient_key ) ) ) {
			$instagram_feed = array();
			$response       = wp_remote_get( $instagram_api );

			if ( ! is_wp_error( $response ) ) {
				if ( 200 === wp_remote_retrieve_response_code( $response ) ) {
					$body = json_decode( wp_remote_retrieve_body( $response ) );

					if ( ! empty( $body->items ) ) {
						foreach ( $body->items as $image ) {
							$instagram_feed[ $image->created_time ] = array(
								'src'     => $image->images->standard_resolution->url,
								'link'    => $image->link,
								'caption' => $image->caption->text,

					set_transient( $transient_key, $instagram_feed, self::TRANSIENT_EXPIRE );
				} else {
					return new \WP_Error( 'instagram_feed_failed', __( 'Failed to retrieve Instagram feed', 'instagram' ) );
			} else {
				return $response;

		return $instagram_feed;

$instagram = new Instagram();
$instagram->display( 'mattgeri' );

How The WordPress Instagram Feed Snippet Works

So! What’s happening in the above snippet?

Line 63: display is a public method that can be called on the class and it will fetch the feed (see line 64) and then output a unordered list (see line 68) of all the images that were returned from the feed.

Line 96: If you’ve got a keen eye, you’ll notice that I’m using a JSON feed that is provided by Instagram to fetch the images that have been uploaded by the user.

Line 112: We then cache the results inside a WordPress transient so that we don’t hit up the Instagram feed on every page load. We cache the results for a day (see line 48)

That’s pretty much it! If something goes wrong, a WP_Error is returned and we handle it gracefully on line 78. Feel free to play around with the class and make it even better! Send me a link once it’s done so that I can check it out.

Free WordPress Instagram Feed Plugin

So just because I can, I’m bundling up this snippet in to a free, open source plugin that you can download and install from the WordPress plugin repo. Check back in a couple days for the plugin URL.

Should WordPress developers be taken more seriously?

I recently wrote an article for SitePoint.com on the ultimate WordPress development environment. If you’ve been following me for a while you will know this is something I’ve spent a good deal of time figuring out.

What surprised me was the feedback that I got on the article.

Using the word “ultimate” in the title was definitely a little bit contentious, and I expected to have some readers push back on it. However, they didn’t. The feedback I got on the content of the article was quite positive.

Out of nowhere though, a number of people started critiquing me for implying that you could apply coding standards to WordPress. Reading deeper in to their thoughts, the crux of their argument seemed to be that they feel WordPress is architected really badly and inherently, anyone who works on WordPress must be a sub-par developer just because of their association with the platform.

That’s a very unfair judgment and from my experience, very far from the truth.

So why is that an unfair judgment?

To answer that question, we really need to look at one simple thing. Why do developers choose WordPress?

Why do developers work with WordPress?

I think we could all agree that there are architectural blemishes in Core, but good developers still choose to work with WordPress despite this. Here’s why.

  • Open source. That warm fuzzy feeling inside from contributing code to a greater cause.
  • Large share of the market. 25%, enough said!
  • Established platform. Large and small, old and new businesses are running on it (including some of the biggest brands).
  • Easily extendable. Actions and filters.
  • The business opportunity also can’t be ignored.

Because of all of this and more, WordPress has a thriving development community and it’s only getting bigger and better.

Are architectural hiccups in Core a good enough reason to ignore all of the platform benefits? Personally I don’t think so.

So the question then becomes, why should WordPress developers be taken seriously?

Why should WordPress developers be taken more seriously?

They should be taken more seriously, not because of the platform they choose to develop on, but for the skills that they demonstrate in their work. Skills like…

  • Working with bleeding edge frameworks and tools. The REST API has opened up opportunities for heavy JS development and apart from that, the tooling available for WordPress is on par with other communities like Ruby, Python and Go.
  • Writing well architected WordPress themes, plugins and applications. Plugins, themes and applications don’t have to be restricted by the architecture of Core. I’ve seen tons of really well architected plugins. Good WordPress developers do apply standards to their code and care about their craft.
  • Solving hard challenges. If you’re working with any semi-decent sized WordPress website there are challenges around scaling that need to be addressed. There are many other kinds of challenges around architecture, design, UI and more. Challenges make stronger developers.
  • Community spirit. You’ll find that many WordPress developers have a good sense of community spirit and this makes them great team players.

These skills are desirable of any developer. WordPress developers are no exception. And that is why WordPress developers should be taken more seriously.