
如何使用Gatsby为WordPress生成静态网站
the_weekday_date ( $before = '', $after = '' )
the_weekday_date: 这个函数检索给定日期的日期和工作日名称或WordPress时区的当前日期。
显示写文章的工作日。
只有在当前文章的工作日与前一个工作日不同的情况下,才会输出该工作日。
function the_weekday_date( $before = '', $after = '' ) { global $wp_locale, $currentday, $previousweekday; $post = get_post(); if ( ! $post ) { return; } $the_weekday_date = ''; if ( $currentday !== $previousweekday ) { $the_weekday_date .= $before; $the_weekday_date .= $wp_locale->get_weekday( get_post_time( 'w', false, $post ) ); $the_weekday_date .= $after; $previousweekday = $currentday; } /** * Filters the localized date on which the post was written, for display. * * @since 0.71 * * @param string $the_weekday_date The weekday on which the post was written. * @param string $before The HTML to output before the date. * @param string $after The HTML to output after the date. */ echo apply_filters( 'the_weekday_date', $the_weekday_date, $before, $after ); }