Skip to content

Instantly share code, notes, and snippets.

@billerickson billerickson/functions.php Secret
Last active Jan 4, 2019

Embed
What would you like to do?
<?php
/**
* Multiple Authors in DPS
* @see https://displayposts.com/2019/01/04/display-multiple-authors-using-co-authors-plus/
*/
function be_multiple_authors_in_dps( $output = '', $original_atts = array() ) {
if( ! function_exists( 'coauthors' ) )
return $output;
$atts = shortcode_atts( array(
'coauthor_function' => 'coauthors',
'coauthor_between' => ', ',
'coauthor_between_last' => ' and ',
'coauthor_before' => 'by ',
'coauthor_after' => '',
), $original_atts, 'dps-coauthor-addon' );
$function = in_array( $atts['coauthor_function'], array( 'coauthors', 'coauthors_posts_links', 'coauthors_links' ) ) ? $atts['coauthor_function'] : 'coauthors';
$between = esc_html( $atts['coauthor_between'] );
$between_last = esc_html( $atts['coauthor_between_last'] );
$before = esc_html( $atts['coauthor_before'] );
$after = esc_html( $atts['coauthor_after'] );
$echo = false;
return ' <span class="author">' . call_user_func_array( $function, array( $between, $between_last, $before, $after, $echo ) ) . '</span>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.