skip to Main Content

Display Co-Authors in Post Meta

This snippet shows how you can display multiple authors via the Co-Authors plugin within the theme's meta section (this is the section that displays the post author, category, date..etc below the post title by default).

/**
 * Display Co-Authors in Blog Post Meta.
 *
 * @link https://total.wpexplorer.com/docs/snippets/display-co-authors-in-post-meta/
 */
function my_custom_meta_sections( $sections ) {
	if ( function_exists( 'coauthors_posts_links' ) ) {
		$sections['author'] = function() {
			echo '<span class="ticon ticon-user-o" aria-hidden="true"></span><span class="vcard author"><span class="fn">' . coauthors_posts_links( null, null, null, null, false ) . '</span></span>';
		}
	}

	return $sections;
}
add_filter( 'wpex_blog_entry_meta_sections', 'my_custom_meta_sections' );
add_filter( 'wpex_blog_single_meta_sections', 'my_custom_meta_sections' );
All PHP snippets should be added via child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)
Back To Top