Changeset 45379
- Timestamp:
- 05/23/2019 12:37:56 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/general-template.php
r45378 r45379 2683 2683 global $wp_locale; 2684 2684 2685 $the_weekday = $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) ); 2685 $post = get_post(); 2686 2687 if ( ! $post ) { 2688 return; 2689 } 2690 2691 $the_weekday = $wp_locale->get_weekday( get_post_time( 'w', false, $post ) ); 2686 2692 2687 2693 /** … … 2703 2709 * @since 0.71 2704 2710 * 2705 * @global WP_Locale $wp_locale The WordPress date and time locale object.2706 * @global string $currentday The day of the current post in the loop.2707 * @global string $previous day The day of the previous post in the loop.2711 * @global WP_Locale $wp_locale The WordPress date and time locale object. 2712 * @global string $currentday The day of the current post in the loop. 2713 * @global string $previousweekday The day of the previous post in the loop. 2708 2714 * 2709 2715 * @param string $before Optional. Output before the date. … … 2711 2717 */ 2712 2718 function the_weekday_date( $before = '', $after = '' ) { 2713 global $wp_locale, $currentday, $previousday; 2719 global $wp_locale, $currentday, $previousweekday; 2720 2721 $post = get_post(); 2722 2723 if ( ! $post ) { 2724 return; 2725 } 2714 2726 2715 2727 $the_weekday_date = ''; 2716 2728 2717 if ( is_new_day()) {2729 if ( $currentday !== $previousweekday ) { 2718 2730 $the_weekday_date .= $before; 2719 $the_weekday_date .= $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false) );2731 $the_weekday_date .= $wp_locale->get_weekday( get_post_time( 'w', false, $post ) ); 2720 2732 $the_weekday_date .= $after; 2721 $previous day= $currentday;2733 $previousweekday = $currentday; 2722 2734 } 2723 2735 -
trunk/tests/phpunit/tests/date/theDate.php
r45378 r45379 139 139 140 140 ob_start(); 141 $GLOBALS['currentday'] = '18.09.15';142 $GLOBALS['previous day'] = '17.09.15';141 $GLOBALS['currentday'] = '18.09.15'; 142 $GLOBALS['previousweekday'] = '17.09.15'; 143 143 the_weekday_date(); 144 144 $this->assertEquals( 'Wednesday', ob_get_clean() ); 145 145 146 146 ob_start(); 147 $GLOBALS['currentday'] = '18.09.15';148 $GLOBALS['previous day'] = '17.09.15';147 $GLOBALS['currentday'] = '18.09.15'; 148 $GLOBALS['previousweekday'] = '17.09.15'; 149 149 the_weekday_date( 'before ', ' after' ); 150 150 $this->assertEquals( 'before Wednesday after', ob_get_clean() );
Note: See TracChangeset
for help on using the changeset viewer.