Skip to content

Instantly share code, notes, and snippets.

@WerdsWords
Last active December 19, 2015 21:08
Show Gist options
  • Save WerdsWords/6017940 to your computer and use it in GitHub Desktop.
Save WerdsWords/6017940 to your computer and use it in GitHub Desktop.
#4: the_weekday_date
<?php
/**
* Convert a post's published day to pirate when the day is Saturday.
*
* We won't check the string, but rather the numerical representation
* of Saturday, just in case the days of the week are translated.
*
* @see the_weekday_date(), #24781
*
* @param string $day The day of the week the post was published.
* @param string $before Output before the date.
* @param $after Output after the date.
*
* @return string The day of the week.
*/
function wpdocs_piratized_saturday( $day, $before, $after ) {
// 6 is the numerical representation of Saturday, see WP_Locale::get_weekday()
if ( '6' == mysql2date( 'w', get_post()->post_date ) )
return 'SatARRRday';
return $day;
}
add_filter( 'the_weekday_date', 'wpdocs_piratized_saturday', 10, 3 );
@WerdsWords
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment