function news_byline( $byline ) {
global $post;
$user_id = $post->post_author;
$byline_author = get_post_meta($post->ID, 'byline-author', true);
$byline_date = get_post_meta($post->ID, 'byline-date', true);
if ( function_exists( 'get_cimyFieldValue' ) ) {
if ( get_cimyFieldValue( $user_id, 'UNIT' ) ){
$unit = get_cimyFieldValue( $user_id, 'UNIT' );
}
}
$user_info = get_userdata($user_id);
if ( !empty( $user_info->user_email ) ) {
if ( function_exists( 'CoAuthorsIterator' ) ) {
$i = new CoAuthorsIterator();
$i->iterate();
}
if ( function_exists( 'get_cimyFieldValue' ) ) {
$author = '<a href="mailto:'. get_the_author_meta( 'user_email' ) .'?subject=RE: ' . the_title_attribute( 'echo=0' ) . '" title="Contact the author">'. get_the_author_meta( 'display_name' ) .'</a>, '. get_cimyFieldValue( get_the_author_ID(), 'UNIT' );
} else {
$author = '<a href="mailto:'. get_the_author_meta( 'user_email' ) .'?subject=RE: ' . the_title_attribute( 'echo=0' ) . '" title="Contact the author">'. get_the_author_meta( 'display_name' ) .'</a>';
}
if ( function_exists( 'CoAuthorsIterator' ) ) {
while($i->iterate()){
$author .= ', and <a href="mailto:'. get_the_author_meta( 'user_email' ) .'?subject=RE: ' . the_title_attribute( 'echo=0' ) . '" title="Contact the author"">'. get_the_author_meta( 'display_name' ) .'</a>, '. get_cimyFieldValue( get_the_author_ID(), 'UNIT' );
}
}
} else {
$author = '[entry-author]';
}
if ( is_page() && $byline_author == 'No' && $byline_date == 'No' ) {
$byline = '';
} elseif ( is_page() && $byline_author == 'Yes' && $byline_date == 'No' ) {
$byline = '<p class="byline">' . __( '<span class="byline-prep byline-prep-author">By</span> '. $author .' [entry-edit-link before="| "]', hybrid_get_textdomain() ) . '</p>';
} elseif ( is_page() && $byline_author == 'No' && $byline_date == 'Yes' ) {
$byline = '<p class="byline">' . __( 'Posted on [entry-published] [entry-edit-link before="| "]', hybrid_get_textdomain() ) . '</p>';
} else {
$byline = '<p class="byline">' . __( '<span class="byline-prep byline-prep-author">By</span> '. $author .' <span class="byline-prep byline-prep-published">|</span> [entry-published] [entry-edit-link before="| "]', hybrid_get_textdomain() ) . '</p>';
}
return $byline;
}
add_shortcode( 'coauthor-link', 'news_coauthor_shortcode' );
function news_coauthor_shortcode() {
echo '<span class="coauthors">';
if(function_exists('coauthors_posts_links'))
coauthors_posts_links();
else
the_author_posts_link();
echo '</span>';
}