WordPress Dynamically Write Number of Years Since With Shortcode

As the lengthy title says, the follow simple script allows you to use a shortcode to dynamically output the number of years since a specified date. I wrote this for my own bio, which I used to have to update the number of years since the start of my employment once a year. The simple’r solution would be to write, “blah blah blahΒ since 2010” instead of “blah blah blah for 7 years“. But hey, why not.

Simple usage is []years since="2010-07-01"[] would output something like 7.


Leave a Reply

%d bloggers like this: