Created
December 9, 2021 20:00
-
-
Save broskees/828927df933e645fbc6f3f49ea2f54be to your computer and use it in GitHub Desktop.
Year shortcode that shows the next year after december
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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