WordPress.org

Forums

Co-Authors Plus
[resolved] Coauthor's avatar (3 posts)

  1. Ever Calamaco
    Member
    Posted 1 year ago #

    Hey so I love the plugin! I want to see if there is a way to show the coauthors avatar when the coauthors link is clicked instead of the originals author's avatar. This is the code for the single.php showing both authors:
    <?php if ( function_exists( 'coauthors_posts_links' ) ) {
    coauthors_posts_links();
    } else {
    the_author_posts_link();
    }; ?>

    This allows both names to show up. Great!!
    But once the coauthor link is pressed on the author.php the avatar that shows up is the original author. which is this code:
    <?php echo get_avatar($post->post_author); ?>

    Is there a code snippet I can replace this with that states if there is a coauthor avatar, show it, if not show gravatar?

    please help! Really need this to work.

    https://wordpress.org/plugins/co-authors-plus/

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    If <?php echo get_avatar($post->post_author); ?> is in your author.php file, you might instead be able to use:

    <?php echo get_avatar( get_queried_object()->user_email ); ?>

    Your guest author will need an email address set in their profile, however.

  3. Ever Calamaco
    Member
    Posted 1 year ago #

    NICE!!! Works Great! Thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Co-Authors Plus
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.