Skip to content

Instantly share code, notes, and snippets.

@natebot
Last active May 26, 2017 02:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natebot/c537a3b4e51b0b823d91 to your computer and use it in GitHub Desktop.
Save natebot/c537a3b4e51b0b823d91 to your computer and use it in GitHub Desktop.
Add support for serial commas to Co-Authors Plus WordPress plugin.
<?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