I would like to add the standard php echo date code to the footer socket ( the copyright area )
When I add the following:<?php echo date("Y") ?>
it gets stripped out with <!– remarks
I tried wrapping them in [raw] and [code] – no joy
How can we add this, anyone?
Hey AntonNovikov!
Insert this code into the child theme functions.php or enfold/functions.php file:
add_shortcode('year', function(){return date('Y');});
and then insert the shortcode
[year]
into the copyright text field to show the current year.
Regards,
Peter
Hi!
Try changing the function to:
function year_func($atts) {
return date('Y');
}
add_shortcode( 'year', 'year_func' );
You could also try replacing the “year” for another string, maybe there is a plugin that already has registered that shortcode name.
Cheers!
Josue
Create a test.php file on your server with this content and check if it works:
<?php
echo date(‘Y’);
?>
If it doesn’t return anything, then it’s a server issue and you’d need to contact your hosting provider regarding that.
Best regards,
Josue
Ok, let us know how it goes.
Regards,
Josue