Skip to main content
Articles

Plugin for Calculating Anniversaries or Mile Stone Dates with Code!

102
0
Here's a simple WordPress function and short code for calculating things like employee anniversaries, years in business, birthdays or anything that needs to calculate a year based on a starting date.
Download Plugin
Example 1: Celebrating 21 Years!
Celebrating [workiversary anniversary="12-12-2002"] Years!
Exanple 2: Celebrating Over 201 Years in Business!
Celebrating Over [workiversary anniversary="12-12-1822"] Years in Business!
You can skip the plugin and just add this to your themes Functions. This is how it's done and you can use the same short code. Or be brave and create your own plugin entirely.
function status_in_years_shortcodes( $atts ) {if ( empty( $atts['anniversary'] ) ) return '';if ( ( $anniversary = strtotime( $atts['anniversary'] ) ) === false ) return '';$years_diff = date_diff( date_create(), date_create( $atts['anniversary'] ) )->y; return $years_diff;} add_shortcode( 'workiversary', 'status_in_years_shortcodes' );
Corner Icon Render
Corner Icon Render
Corner Icon Render
Corner Icon Render How Can I Help You?