the_weekday_date

Display the weekday on which the post was written.

Description

the_weekday_date( (string) $before = '', (string) $after = '' ); 

Will only output the weekday if the current post's weekday is different from the previous one output.

Parameters (2)

0. $before — Optional. (string) => ''
Output before the date.
1. $after — Optional. (string) => ''
Output after the date.

Usage

  1. if ( !function_exists( 'the_weekday_date' ) ) { 
  2. require_once ABSPATH . WPINC . '/general-template.php'; 
  3.  
  4. // Optional Output before the date. 
  5. $before = ''; 
  6.  
  7. // Optional Output after the date. 
  8. $after = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = the_weekday_date($before, $after); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/general-template.php  
  1. function the_weekday_date($before='', $after='') { 
  2. global $wp_locale, $currentday, $previousweekday; 
  3. $the_weekday_date = ''; 
  4. if ( $currentday != $previousweekday ) { 
  5. $the_weekday_date .= $before; 
  6. $the_weekday_date .= $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) ); 
  7. $the_weekday_date .= $after; 
  8. $previousweekday = $currentday; 
  9.  
  10. /** 
  11. * Filters the localized date on which the post was written, for display. 
  12. * @since 0.71 
  13. * @param string $the_weekday_date 
  14. * @param string $before The HTML to output before the date. 
  15. * @param string $after The HTML to output after the date. 
  16. */ 
  17. $the_weekday_date = apply_filters( 'the_weekday_date', $the_weekday_date, $before, $after ); 
  18. echo $the_weekday_date;