Viewing 1 replies (of 1 total)
  • Not sure if you still require the use of Co-Authors Plus on your website since it’s been 11 months since your post but here is what you need to do to integrate this into your Divi child theme. If you aren’t using a child theme (hint – you should be) updating your functions.php file with the below code will potentially be overwritten when performing theme updates.

    Just drop this code into your Divi child theme functions.php file:

    /* Add Co-Authors Plus functionality to by line */
    function et_pb_postinfo_meta( $postinfo, $date_format, $comment_zero, $comment_one, $comment_more ){
    	$postinfo_meta = '';
    
    	if ( in_array( 'author', $postinfo ) )
    		if ( function_exists( 'coauthors_posts_links' ) ) {
    		    coauthors_posts_links();
    		} else {
    			$postinfo_meta .= ' ' . esc_html__( 'by', 'et_builder' ) . ' <span class="author vcard">' . et_pb_get_the_author_posts_link() . '</span>';
    		}
    
    	if ( in_array( 'date', $postinfo ) ) {
    		if ( in_array( 'author', $postinfo ) ) $postinfo_meta .= ' | ';
    		$postinfo_meta .= '<span class="published">' . get_the_time( wp_unslash( $date_format ) ) . '</span>';
    	}
    
    	if ( in_array( 'categories', $postinfo ) ){
    		if ( in_array( 'author', $postinfo ) || in_array( 'date', $postinfo ) ) $postinfo_meta .= ' | ';
    		$postinfo_meta .= get_the_category_list(', ');
    	}
    
    	if ( in_array( 'comments', $postinfo ) ){
    		if ( in_array( 'author', $postinfo ) || in_array( 'date', $postinfo ) || in_array( 'categories', $postinfo ) ) $postinfo_meta .= ' | ';
    		$postinfo_meta .= et_pb_get_comments_popup_link( $comment_zero, $comment_one, $comment_more );
    	}
    
    	return $postinfo_meta;
    }

    Alternatively if you aren’t using a child theme (even though you should be) you can open the following file:

    /wp-content/themes/Divi/includes/builder/functions.php

    Then look for the function “et_pb_postinfo_meta” which should be around line 2156 as of this time (Divi 2.5.6) and replace lines 2159-60 which looks like this:

    if ( in_array( 'author', $postinfo ) )
    		$postinfo_meta .= ' ' . esc_html__( 'by', 'et_builder' ) . ' <span class="author vcard">' . et_pb_get_the_author_posts_link() . '</span>';

    with this:

    if ( in_array( 'author', $postinfo ) )
    		if ( function_exists( 'coauthors_posts_links' ) ) {
    		    coauthors_posts_links();
    		} else {
    			$postinfo_meta .= ' ' . esc_html__( 'by', 'et_builder' ) . ' <span class="author vcard">' . et_pb_get_the_author_posts_link() . '</span>';
    		}

    Hope that helps anyone who might come across this looking for a solution.

Viewing 1 replies (of 1 total)
  • The topic ‘CoAuthors Plus on ET Divi Theme’ is closed to new replies.