Skip to content

Instantly share code, notes, and snippets.

@itsViney
Last active March 26, 2022 20:44
Show Gist options
  • Save itsViney/679105ddfe8af076175992554b8935a4 to your computer and use it in GitHub Desktop.
Save itsViney/679105ddfe8af076175992554b8935a4 to your computer and use it in GitHub Desktop.
Wordpress shortcode that returns the current year. For footer copyrights, mostly.
/* Basic shortcode to return the current year (for copyright line)
Example: © [year] itsViney
*/
function currentYear($atts)
{
return date('Y');
}
add_shortcode('year', 'currentYear');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment