Support » Plugin: Co-Authors Plus » Extra from Elegant themes implementation

  • Implementing Co-authors plus in Extra theme seems to require some specific code.
    Adding the following code to functions.php :

    if ( function_exists( ‘coauthors_posts_links’ ) ) {
    coauthors_posts_links();
    } else {
    the_author_posts_link();
    }

    Does not lead to display the co-authors in posts.

    I would appreciate some help in this issue

    Kind regards,

    Daniel

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • i just spent 3 hours getting this to work in Divi by Elegant Themes. Should work for Extra as well.

    Create a child theme

    put this in the child theme’s root level functions.php

    if ( ! function_exists( 'et_pb_get_the_author_posts_link' ) ) :
    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(
    			coauthors( 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 );
    }
    endif;

    [Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]

    • This reply was modified 11 months, 2 weeks ago by  joelwroberts.
    • This reply was modified 11 months, 2 weeks ago by  bdbrown.
Viewing 1 replies (of 1 total)
  • The topic ‘Extra from Elegant themes implementation’ is closed to new replies.