Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function genesis_author_pro_book_author(){
global $Genesis_Author_Pro_CPT;
$terms = wp_get_post_terms( get_the_ID(), $Genesis_Author_Pro_CPT->author );
if ( empty( $terms ) || is_wp_error( $terms ) ){
return;
}
$authors = array();
foreach( $terms as $term ){
$authors[] = sprintf( '<a href="%s">%s</a>', esc_url( get_term_link( $term ) ), $term->name );
}
if ( ! empty( $authors ) ) {
printf(
'%s%s',
__( 'By ', 'genesis-author-pro' ),
join(
__( ' and ', 'genesis-author-pro' ),
array_filter(
array_merge(
array( join( __( ', ', 'genesis-author-pro' ), array_slice( $authors, 0, -1 ) ) ),
array_slice( $authors, -1 )
)
)
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment