Current year shortcode

Even though GeneratePress Premium has a function to display the current date in the Copyright section of the Customizer through the %current_year% tag (Customize -> Layout -> Footer), there might be case where you need to display the current year anywhere on your website through a shortcode.

Let’s add a PHP snippet to do just that.

function gm_current_year() {
	return date('Y');
add_shortcode('current_year', 'gm_current_year');

Now you can display the current year by entering the [current_year] shortcode.