WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
[resolved] How to adjust Co-Author Plus tags for Twentyeleven? (3 posts)

  1. Antoni Urban
    Member
    Posted 1 year ago #

    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() ); ?>
    					</a>
    				</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

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

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

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

  3. Antoni Urban
    Member
    Posted 1 year ago #

    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">
    				<h2>
    <?php if ($userdata->display_name) echo $userdata->display_name; ?>
    				</h2>
    <?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); ?>
    				</a>
    			</div><!-- author-link -->
    		</div><!-- #author-info -->
    <?php endforeach; ?>

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic