Hello,
Here is the code that needs to add in themes functions.php
Integrating Template Tags Into Your Theme #
To integrate Co-Authors Plus, you’ll want to replace existing author template tags in your theme with a simple conditional that uses the Co-Authors Plus template tags if Co-Authors Plus is available. The conditional prevents your site from breaking (e.g. white screen of death) if Co-Authors Plus isn’t activated.
For example, here’s how you would update the_author_posts_link() to instead use coauthors_posts_links():
if ( function_exists( 'coauthors_posts_links' ) ) {
coauthors_posts_links();
} else {
the_author_posts_link();
}
However, the example above is a relatively simplistic way of presenting bylines. There’s a good chance your theme will need an adaptation of it.
For instance, here’s how the change looks for the Hybrid theme:
function hybrid_entry_author_shortcode( $attr ) {
$attr = shortcode_atts( array( 'before' => '', 'after' => '' ), $attr );
if ( function_exists( 'coauthors_posts_links' ) ) {
$author = coauthors_posts_links( null, null, null, null, false );
} else {
$author = '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" title="' . esc_attr( get_the_author_meta( 'display_name' ) ) . '">' . get_the_author_meta( 'display_name' ) . '</a></span>';
}
return $attr['before'] . $author . $attr['after'];
}
Here’s the new function for TwentyTen:
if ( ! function_exists( 'twentyten_posted_on' ) ) :
/**
* Integrate Co-Authors Plus with TwentyTen by replacing twentyten_posted_on() with this function
*/
function twentyten_posted_on() {
if ( function_exists( 'coauthors_posts_links' ) ) :
printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
'meta-prep meta-prep-author',
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
get_permalink(),
esc_attr( get_the_time() ),
get_the_date()
),
coauthors_posts_links( null, null, null, null, false )
);
else:
printf( __( '<span class="%1$s"<Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
'meta-prep meta-prep-author',
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
get_permalink(),
esc_attr( get_the_time() ),
get_the_date()
),
sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
get_author_posts_url( get_the_author_meta( 'ID' ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ),
get_the_author()
)
);
endif;
}
endif;
What is for our rehub theme?
Thanks