I know, it’s not normally cool to do that sort of thing. But here’s the thing – I’m not bragging on myself. Except for one little part.
Ok, enough caveats – let the bragging begin.
I have some of the coolest and smartest friends.
There it is. See, mostly it’s not about me – except that networking and developing relationships does take a bit of work on my part. But these folks make it so easy.
I want to tell you about Syed.
Anyway, the other day he and I were talking about dates on articles and we both agreed that we should show the “last updated” dates on our posts. The only difference was that he’d done it on his site already and I hadn’t.
That’s ok, I don’t mind losing to Syed. He’s half my age and I’m already convinced he’s done more than I will in a lifetime. So I’ve gotten used to expecting to lose. Plus, he gamifies everything. If you don’t know what that means, you’re lucky.
That means Syed’s article was close but not an exact match. That’s not a problem when you’re hosted on WP Engine because they give you a staging server where you can test everything you do without stress.
So that’s what I did.
Hooks and Short Codes
Dynamik makes it really easy to hook into any spot within Genesis, so that’s good news. If you don’t know what that means, let me state it a bit more simply. Genesis isn’t just a parent theme – it’s a theme framework – coded in a way to let you insert, adjust, or generally tweak the code in ways they can’t predict.
I said I’d say it more simply, but that didn’t make it easier, did it? It’s ok, I’ll show you.
Now, on top of Genesis, I’m using Dynamik – which helps me adjust the look and feel without tons of CSS (though nothing stops me from using it).
And in this child theme, Dynamik gives me access to “Dynamik Custom” – where I can create my own short codes. So that’s what I did.
echo “Last updated on
echo ” itemprop=’dateModified’ class=’entry-time’>”;
the_modified_time(‘F jS, Y’);
But knowing the code doesn’t explain what it does or how it works.
What it does
The code is doing three things at once.
The first thing is that it’s replacing the original publish date for the last modified date. That’s important so that when people get to one of my posts, they know how “fresh” it is.
The second thing it’s doing is formatting the last modified date – twice. The second time you see “the_modified_time” you’re seeing the format for how it will look for people on the screen.
The third thing it’s doing is something powerful that I’ve started digging into more. See, on page SEO is all about giving Google (and other search engines) as many hints as you can about what your content says.
In the past, engines like Google would grab all the text and create it’s own semantic mesh of the network of words on your page and what they knew of them. That’s the network map they’d use to determine meaning.
But recently, and completely supported in Genesis 2.0, they’ve started letting us help them. That’s what you see in the rest of the code above. It’s the technical way to tell Google that this is the official last modified date and time. And that ‘c’ in the formatting gives it the format that Google likes the best.
Can I tell you about my friend Robert?
While I knew schemas existed and that I needed to do it, I didn’t know which parts, structures, and formats were best. He’s a busy guy, but he’s always willing to lend a hand. So in 10 minutes, he pointed me to the right spot.
Side note: when I tipped him a “thank you” via Paypal, do you think I calculated it based on how long it took him, or how long it would have taken me? I bet you know.
How it works
Now, for many folks, the Simple Edits plugin for Genesis is the easiest way to modify what shows up in your post meta. That’s why I decided, when creating this bit of code, to turn it into a short code.
You’ll see above that I named it last_updated. That let me use it in the Simple Edits screen, simply by replacing the previous date shortcode with the last_updated short code.
Could I have done something similar by just hooking my code to one of Genesis’ many hooks? Yes, but since I was already using Simple Edits, the short code approach seemed the most consistent.
I blog regularly, so I’m not too worried about Google catching the change. But if I blogged less, I’d also be working to get some of my key articles re-indexed by Google so that they show a more recent date (the last modified date).
Thankfully, I’m not too worried, and that’s all I had to do. Good luck!