Skip to content

Instantly share code, notes, and snippets.

@broskees
Created December 9, 2021 20:00
Show Gist options
  • Save broskees/828927df933e645fbc6f3f49ea2f54be to your computer and use it in GitHub Desktop.
Save broskees/828927df933e645fbc6f3f49ea2f54be to your computer and use it in GitHub Desktop.
Year shortcode that shows the next year after december
<?php
add_shortcode('year', function() {
$current_year = date('Y');
$thanksgiving = strtotime("December 1st $current_year");
return $thanksgiving < time() ? $current_year + 1 : $current_year;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment