A small feature that I always end up adding to most client websites I make, particularly larger template themes that I use for rapidly developing multiple projects is a very simple but useful shortcode for displaying the current year.

Paste this into your functions.php of your child theme.

/* create shortcode for displaying dynamic year in copyright footer */
function year_shortcode() {
   $year = date('Y');
   return $year;
add_shortcode('year', 'year_shortcode');

Place the year shortcode into any wordpress text edit / text field and it will print out the current year.


Ideal for including in footers or copyright content so that it’s always up to date (particularly if you start needing to edit an entire template page for just that one date or you don’t have easy access to those areas in your theme files.

Leave a Reply

Your email address will not be published. Required fields are marked *