Guest User

Coauthors Plus insert for Newspaper 6 WP Theme

a guest
Apr 28th, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <?php
  2. if (td_util::get_option('tds_p_show_author_name') != 'hide') {
  3. $coauths = get_coauthors();
  4. if (count($coauths) == '2') {
  5. echo "<div class=\"td-post-author-name\">By ";
  6.  
  7. foreach ($coauths as $key => $coauth) {
  8. echo '<a href="/author/' . $coauth->user_nicename . '">' . $coauth->display_name . '</a>';
  9. // add "and"
  10. if ($key == count($coauths) - 2) {
  11. echo 'and ';
  12. $coauths = substr($coauthsHTML, 0, -2);
  13. }
  14. }
  15. echo ' - </div> ';
  16. }
  17. elseif (count($coauths) == 3 || count($coauths) == 4) {
  18. echo "<div class=\"td-post-author-name\">By ";
  19.  
  20. foreach ($coauths as $key => $coauth) {
  21. echo '<a href="/author/' . $coauth->user_nicename . '">' . $coauth->display_name . '</a>';
  22. // add "and"
  23. if ($key == count($coauths) - 4) {
  24. echo ', ';}
  25. if ($key == count($coauths) - 3) {
  26. echo ', ';}
  27. if ($key == count($coauths) - 2) {
  28. echo ', and ';
  29. $coauths = substr($coauthsHTML, 0, -4);
  30. }
  31. }
  32. echo ' - </div> ';
  33. }
  34.  
  35. else {
  36. echo $td_mod_single->get_author();
  37. };
  38.  
  39. }
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment