Make WordPress Core

Changeset 57301


Ignore:
Timestamp:
01/17/2024 08:59:42 AM (15 months ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwenty/footer.php

    r52023 r57301  
    2121                        <p class="footer-copyright">&copy;
    2222                            <?php
    23                             echo date_i18n(
    24                                 /* translators: Copyright date format, see https://www.php.net/manual/datetime.format.php */
    25                                 _x( 'Y', 'copyright date format', 'twentytwenty' )
    26                             );
     23                            /* translators: Copyright date format, see https://www.php.net/manual/datetime.format.php */
     24                            $date_format = _x( 'Y', 'copyright date format', 'twentytwenty' );
     25                            if ( function_exists( 'wp_date' ) ) {
     26                                echo wp_date( $date_format );
     27                            } else {
     28                                echo date_i18n( $date_format );
     29                            }
    2730                            ?>
    2831                            <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a>
Note: See TracChangeset for help on using the changeset viewer.