Twenty Twenty: Replace wp_date() with date_i18n().

Since WordPress 5.3 it is recommended to use `wp_date()` instead of `date_i18n()`. This changeset replaces the function in Twenty Twenty, with a fallback to `date_i18n()` for old versions of WordPress.

For more info, see https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/.

Props sachyya-sachet, joyously, sabernhardt, poena.
Fixes #48589.





git-svn-id: https://develop.svn.wordpress.org/trunk@57301 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras 2024-01-17 08:59:42 +00:00
parent a4500a1807
commit bb1c19f3b7

View File

@ -20,10 +20,13 @@
<p class="footer-copyright">&copy;
<?php
echo date_i18n(
/* translators: Copyright date format, see https://www.php.net/manual/datetime.format.php */
_x( 'Y', 'copyright date format', 'twentytwenty' )
);
/* translators: Copyright date format, see https://www.php.net/manual/datetime.format.php */
$date_format = _x( 'Y', 'copyright date format', 'twentytwenty' );
if ( function_exists( 'wp_date' ) ) {
echo wp_date( $date_format );
} else {
echo date_i18n( $date_format );
}
?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a>
</p><!-- .footer-copyright -->