Last active
December 19, 2015 21:08
-
-
Save WerdsWords/6017940 to your computer and use it in GitHub Desktop.
#4: the_weekday_date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://fotd.werdswords.com/the_weekday_date/