Support » Plugins and Hacks » Co-Authors Plus » [Resolved] How to adjust Co-Author Plus tags for Twentyeleven?

[Resolved] How to adjust Co-Author Plus tags for Twentyeleven?

  • Hi

    Having downloaded and activated Co-Author Plus, I am struggling to make it working with Twentyeleven. As an experienced programmer but not in PHP, I am trying to replace “the_author” by “coauthors” in the below placed code (“author-info” below a post):

    <?php if ( get_the_author_meta( 'description' ) && ( ! function_exists( 'is_multi_author' ) || is_multi_author() ) ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries ?>
    		<div id="author-info">
    			<div id="author-avatar">
    				<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 68 ) ); ?>
    			</div><!-- #author-avatar -->
    			<div id="author-description">
    				<h2><?php printf( __( 'About %s', 'twentyeleven' ), get_the_author() ); ?></h2>
    				<?php the_author_meta( 'description' ); ?>
    				<div id="author-link">
    					<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
    						<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentyeleven' ), get_the_author() ); ?>
    				</div><!-- #author-link	-->
    			</div><!-- #author-description -->
    		</div><!-- #author-info -->
    		<?php endif; ?>

    Some functions do not have their equivalents in template-tags.php.

    Looking forward to your advise, I send best regards – au


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Daniel Bachhuber


    Hand Built

    I’d recommend checking out this thread, which addresses a similar problem. Let me know where you end up.

    Thanks Daniel for your answer, the thread will be studied thoroughly. Must admit, I was too quick in sending the question. Two hours later, I had a solution, which performed what was expected.

    Here it is (for others in a similar situation):

    <?php $coauthors = get_coauthors(); ?>
    <?php foreach($coauthors as $coauthor): ?>
    		<div id="author-info">
    <?php $userdata = get_userdata($coauthor->ID); ?>
    			<div id="author-avatar">
    <?php echo get_avatar($coauthor->ID,'68'); ?>
    			</div><!-- #author-avatar -->
    			<div id="author-description">
    <?php if ($userdata->display_name) echo $userdata->display_name; ?>
    <?php if ($userdata->user_description) echo $userdata->user_description; ?>
    			</div><!-- #author-description -->
    			<div class="author-link">
    				<a href="<?php echo get_author_posts_url($coauthor->ID,$coauthor->user_nicename); ?>">
    <?php printf( __('View all posts by %s <span class="meta-nav">→</span>','twenty eleven'),$userdata->display_name); ?>
    			</div><!-- author-link -->
    		</div><!-- #author-info -->
    <?php endforeach; ?>

    All the best to you and the Co-Authors Plus team – au

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] How to adjust Co-Author Plus tags for Twentyeleven?’ is closed to new replies.
Skip to toolbar