I was getting tired of either being generic about my age (twentysomething), or having to update it every year in my About pages. So instead, I set about creating a shortcode that would automatically update my age every year. Here is the snippet that you need to drop into your functionality plugin:
Now, in order to display your age, you just need to paste the shortcode in to your page, using the ‘birthday’ attribute to tell WordPress when you were born. For example, for me, it would look like this:
Aside from showing you that it’s my birthday soon, (feel free to send me some chocolates), this shortcode will do the leg work for you and update your age automatically. And then, if you’re feeling a little bit old, you can just tweak your shortcode and instantly make yourself feel better. Ta da!
Dave has been tinkering with WordPress for many years, and he now shares his WordPress knowledge here on Do It WIth WordPress to help others realise its impressive power. He can also be hired to help with your WordPress needs.
Dave, who is British, is married to his best friend, Marti, with whom he has a beautiful daughter, Ellie. When he's not dabbling with WordPress, he's probably eating Triscuits or hummus, watching an indie film or British TV show, spending time with friends or family, or exploring the world.