WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
[resolved] Template tags create duplicate entries of authors (7 posts)

  1. uslakar
    Member
    Posted 2 years ago #

    I have a site using the twentyeleven theme edited by a child theme.
    I am trying to use the coauthors_posts_links() tag and it works as far as getting the authors but it returns two sets of authors.
    If the authors are fred and jim it will dispaly lke this: "Posted by fred and jimfred and jim"
    I tried changing the location in the "page" and also tried the coauthors() tag and get the same results of two sets of authors.
    Not sure if this is the plugin issue or a WP issue. Any help or direction to look in would be greatly appreciated.

    Thanks

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

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Can you post the code you're using into Pastebin and share here?

  3. uslakar
    Member
    Posted 2 years ago #

    Here it is, if I did this correct:
    <script src="http://pastebin.com/embed_js.php?i=6Fpagkw3"></script>

    function twentyeleven_posted_on() {
    
     if ( function_exists( 'coauthors' ) ) {
    	printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard">', 'twentyeleven' ),
    		esc_url( get_permalink() ),
    		esc_attr( get_the_time() ),
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() )
    	);
    	echo coauthors_posts_links().'</span></span>';
      }
    else
    	{
    	printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time>	</a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyeleven' ),
    		esc_url( get_permalink() ),
    		esc_attr( get_the_time() ),
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() ),
    		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    		esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ),
    		sprintf(get_the_author() )
    	);  }
    }
  4. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    You might want to try something like this instead:

    function twentyeleven_posted_on() {
    echo 'Posted on <a href="' . get_permalink() . '">' . get_the_date() . '</a> by';
    if ( function_exists( 'coauthors_posts_links' ) )
    coauthors_posts_links();
    else
    the_author();
    }

    It removes some of the markup so you might want to add that back in if you need it.

  5. uslakar
    Member
    Posted 2 years ago #

    Thanks, that did the trick.

  6. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Great to hear :)

  7. andyildefonso
    Member
    Posted 2 years ago #

    I think this problem is similar to mine. Can someone help me out. Here are the details.

    I used the co-author plug-in for this article and manage to setup the authors info below the article. Here's the link:
    http://www.asiapathways-adbi.org/2012/03/reforming-asias-trade-in-services-will-help-human-development/

    But, when you click the archive link of the author, it display also the co-author bio instead of only one bio.

    See below the code. Any help is deeply appreciated.

    <?php
    		}
    	}
    }
    
    /*-----------------------------------------------------------------------------------*/
    /* Author Box */
    /*-----------------------------------------------------------------------------------*/
    
    if ( ! function_exists( 'woo_author' ) ) {
    	function woo_author() {
    		// Author box single post page
    		if ( is_single() && get_option( 'woo_disable_post_author' ) != 'true' )
    			add_action( 'woo_post_inside_after', 'woo_author_box', 10 );
    		// Author box author page
    		elseif ( is_author() )
    			add_action( 'woo_loop_before', 'woo_author_box', 10 );
    	}
    }
    
    /*-----------------------------------------------------------------------------------*/
    /* Single Post Author */
    /*-----------------------------------------------------------------------------------*/
    if ( ! function_exists( 'woo_author_box' ) ) {
    
    	function woo_author_box() {
    		global $post;
    		$author_id=$post->post_author;
    	?>
    
    	<?php
    		$i = new CoAuthorsIterator();
    		while($i->iterate()){
    	?>
    
    	<div id="post-author">
    	<div class="profile-image">
    		<?php echo get_avatar( get_the_author_meta('ID'), '80' ); ?>
    	</div>
    
    	<div class="profile-content">
    		<h4>
    		<?php printf( esc_attr__( 'About %s', 'woothemes' ), get_the_author('description', $author_id) ); ?></h4>
    		<?php echo get_the_author_meta( 'description'); ?>
    
    		<?php if (is_singular()) : ?>
    
    		<div class="profile-link">
    			<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">
    				<?php printf( __( 'View all posts by %s <span class="meta-nav">→</span>', 'woothemes' ), get_the_author( 'display_name', $author_id ) ); ?>
    			</a>
    		</div><!-- #profile-link -->
    		<?php endif; ?>
    
    	</div>
    	<div class="fix"></div>
    	</div>
    
    	<?php } ?>
    
    <?php
    	}
    }

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic