Dynamic Date in Footer (X)

Hi there,

I have built a number of sites with X and Pro. I am setting up a new site in X and want a dynamic footer. Everytime I’ve done this I’ve searched the forum and used a different technique.

The only threads I can find on this new forum are for Pro.

Can you please give me the most up to date (and hopefully long-lasting) method to have a dynamic year in the Footer to use as the Copyright date?

Thanks!

Hi There,

Please add the following code under functions.php file locates in your child theme:

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

Then you can use this shortcode in your footer content to get the current year: [current_year]

5 Likes

Thank you, all working fine. I have saved this to my notes.

Glad we were able to help :slight_smile: