New Paste

 

Recent Pastes

Administrate




PageLines PasteBin.

PasteID: 7v
Pasted by Anonymous, 2012-04-05 19:33:13 GMT
Expires Never
Paste size 709 b
Toggle Expand   Wrap   Raw
Copy Contents   Copy URL
 
  1. /**
  2.  * This function/shortcode will show all authors on a post
  3.  * 
  4.  * @example <code>[show_authors]</code> is the default usage
  5.  * @example <code>[show_authors]</code>
  6.  */
  7. function show_multiple_authors() {
  8. 	$i = new CoAuthorsIterator();
  9. 	$return = '';
  10. 	$i->iterate();
  11. 	$return .= '<a href="'.get_author_posts_url(get_the_author_meta('ID')).'">'.get_the_author_meta('display_name').'</a>';
  12. 	while($i->iterate()){
  13. 		$return.= $i->is_last() ? ' and ' : ', ';
  14. 		$return .= '<a href="'.get_author_posts_url(get_the_author_meta('ID')).'">'.get_the_author_meta('display_name').'</a>';
  15. 	}
  16.  
  17. 	return $return;
  18. }
  19. add_shortcode('show_authors', 'show_multiple_authors');
 
 
 

 
 
 
 
 
Written by Xan Manning, 2010.
YOU NEED FLASH!