-
-
Save erochest/3219134 to your computer and use it in GitHub Desktop.
Changes how creators are listed depending on their numbers
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 | |
/** | |
* One Creator: "Jane Doe" | |
* Two creators: "Jane Doe and John Doe" | |
* Three creators: "Jane Doe, John Doe, and Jim Doe" | |
* Four or more: "Jane Doe et al." | |
*/ | |
if ($creators) { | |
switch (count($creators) { | |
case 1: | |
$cite = $creators[0]; | |
break; | |
case 2: | |
$cite = "{$creators[0]} and {$creators[1]}"; | |
break; | |
case 3: | |
$cite = "{$creators[0]}, {$creators[1]}, and {$creators[2]}"; | |
break; | |
default: | |
$cite = "{$creators[0]}, et al."; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment