Last active
May 26, 2017 02:04
-
-
Save natebot/c537a3b4e51b0b823d91 to your computer and use it in GitHub Desktop.
Add support for serial commas to Co-Authors Plus WordPress plugin.
This file contains hidden or 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 | |
/** | |
* Add support for serial commas to Co-Authors Plus WordPress plugin. | |
* Filters coauthors_default_between_last to support serial commas (oxford comma) for 3 or more coauthors | |
*/ | |
add_filter( 'coauthors_default_between_last', function( $between_last ) { | |
if ( ' and ' === $between_last && count( get_coauthors() ) > 2 ) { | |
$between_last = ', and '; | |
} | |
return $between_last; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment