Hi,
I recently downloaded and activated the Coauthors plugin. I would like to know how to edit my child theme files to make the coauthors to appear at the top of each post. The only related message I found related was associated with the Fashionistas theme (Co-Authors Plus Template Tag).
Roughly following the advice you gave on that topic, I edited the function sydney_posted_on() in my Sydney Pro Child theme functions.php file (I have posted the function below) and replaced this line:
esc_html( get_the_author() )
with
coauthors_posts_links()
This produces a duplicate of the coauthors under the title of the post. Could you tell me how to modify the below code to avoid the duplication please?
That would be a great help!
Cheers
Tilla
function sydney_posted_on() {
$time_string = ‘%2$s’;
if ( get_the_time( ‘U’ ) !== get_the_modified_time( ‘U’ ) ) {
$time_string = ‘%2$s%4$s’;
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
$posted_on = sprintf(
_x( '%s', 'post date', 'sydney' ),
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
);
$byline = sprintf(
_x( '%s', 'post author', 'sydney' ),
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
);
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '<span class="comments-link">';
comments_popup_link( __( 'Leave a comment', 'sydney' ), __( '1 Comment', 'sydney' ), __( '% Comments', 'sydney' ) );
echo '</span>';
}
$categories_list = get_the_category_list( __( ', ', 'sydney' ) );
if ( $categories_list && sydney_categorized_blog() ) {
printf( '<span class="cat-links">' . __( '%1$s', 'sydney' ) . '</span>', $categories_list );
/* printf( $categories_list ); Using this removes the category widget*/
}
}