wpexplorer / wpex-blogger

Blogger Free WordPress Theme
GNU General Public License v2.0
5 stars 1 forks source link

Set current year in the custom copyright #4

Closed Alex-JTI closed 3 years ago

Alex-JTI commented 3 years ago

In the version 2.0 I used to have code <script type="text/javascript">document.write( new Date().getUTCFullYear() );</script> that worked like a charm to output current year in the copyright footer. With the version 2.1 it doesn't.

<?php echo date("Y"); ?> doesn't work either.

Can you suggest please how to archive it?

wpexplorer commented 3 years ago

Hi,

This is due to new sanitization on the output of the footer code (for security reasons). The best way is using a date shortcode . You could use this plugin: https://wordpress.org/plugins/current-year-shortcode/

Or if you are using a child theme you can add your own shortcode like this:

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

Then use [current_year] in your copyright text in the customizer.

Alex-JTI commented 3 years ago

Thank you very much, this did the job well!