Add Co Authors Plus plugin into Divi theme - kary4/divituts GitHub Wiki
Customize the post meta to work wo Co-Authors plus plugin
Activate a child theme
The first step in adding integration of the Co-Authors Plus plugin to Divi, is to have a properly configured child theme active to your server.
You can download a proper child theme, from this https://github.com/eduard-ungureanu/Divi-Child-Theme
Implementing the changes
- in your Child Theme folder open and edit the
functions.php
file - add this code to
functions.php
file
function et_pb_get_the_author_posts_link(){
global $authordata, $post;
// Fallback for preview
if ( empty( $authordata ) && isset( $post->post_author ) ) {
$authordata = get_userdata( $post->post_author );
}
// If $authordata is empty, don't continue
if ( empty( $authordata ) ) {
return;
}
if ( function_exists( 'coauthors_posts_links' ) ) {
$link = sprintf(
'<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
esc_attr( sprintf( __( 'Posts by %s', 'et_builder' ), get_the_author() ) ),
coauthors_posts_links( null, null, null, null, false )
);
} else {
$link = sprintf(
'<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
esc_attr( sprintf( __( 'Posts by %s', 'et_builder' ), get_the_author() ) ),
get_the_author()
);
}
return apply_filters( 'the_author_posts_link', $link );
}
- make sure you clear your browser and server cache
Note: Since we have changed the default Divi function that display the author this change will be also reflecting on the Blog module, Post Title, Post Slider, etc