Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save braddalton/b1e00c8a68eca3fa3c0f59e5160595d2 to your computer and use it in GitHub Desktop.
Save braddalton/b1e00c8a68eca3fa3c0f59e5160595d2 to your computer and use it in GitHub Desktop.
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