WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
[resolved] Co-authors show up twice (5 posts)

  1. pleasureinstitute
    Member
    Posted 1 year ago #

    Hi, everyone.

    Whenever I activate Co-Authors Plus, the authors get echoed one line before getting returned to the page. The result is that the names show up once at the very top of my page, from the echo, and then they show up again below my title, from the return, where they should be.

    I've traced this behavior to the file template-tags.php. In that file, coauthors__echo( $tag, $type = 'tag', $separators = array(), $tag_args = null, $echo = true ) is where authors get echoed and returned.

    if( $echo )
    	echo $output;
    
    return $output;

    The first thing I tried was to set $echo = false, but I guess another function is specifically passing true to coauthors__echo. In the past I've fixed this by simply commenting out echo $output;, but of course, after every update, this gets undone.

    Is anyone else experiencing this behavior or am I just doing something wrong?

    http://wordpress.org/extend/plugins/co-authors-plus/

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Can you share the code you're using to show your co-authors?

  3. pleasureinstitute
    Member
    Posted 1 year ago #

    I put the following in a shortcode in my theme's functions.php.

    if(function_exists('coauthors_posts_links')){
        return coauthors_posts_links();
    }
    else{
        return builder_get_author_link();
    }
  4. pleasureinstitute
    Member
    Posted 1 year ago #

    Oh, ha. I feel silly. I just noticed,

    function coauthors_posts_links( $between = null, $betweenLast = null, $before = null, $after = null, $echo = true ){

    beneath coauthors__echo().

    Is the API available anywhere? All I found was the VIP page, but that wasn't very detailed.

  5. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Sorry about that. The API is detailed in the template-tags.php file. I've updated the PHPdoc for each function.

    I also tried clarifying template tags some on the VIP page. Because each theme is different though, it's hard to provide super-specific instructions.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic