• Resolved rudyzzz

    (@rudyzzz)


    When using the WP function get_avatar($coauthor->ID, 100) the avatar displays the default avatar image instead of the image set in guest authors, seem to work fine when the user is a contributor, subscriber, editor, etc.

    
    <?php if (function_exists('get_coauthors')) :  ?>
      <?php $coauthors = get_coauthors(); ?>
      <?php foreach ($coauthors as $coauthor) : ?>
        <div class="row post__author">
          <div class="col-12 col-md-auto d-flex">
            <figure class="post__author--image">
              <?= get_avatar($coauthor->ID, 100); ?>
            </figure>
            <h5 class="post__author--name d-inline-block d-md-none"><?= $coauthor->display_name; ?></h5>
            <div class="col post__author--bio">
              <h5 class="post__author--name d-none d-md-block"><?= $coauthor->display_name; ?></h5>
              <?php if ($coauthor->description) echo $coauthor->description; ?>
            </div>
          </div>
        </div>
      <?php endforeach; ?>
    <?php endif : ?>
    
    • This topic was modified 5 years, 2 months ago by rudyzzz.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter rudyzzz

    (@rudyzzz)

    This fixed the issue:

    Replace get_avatar() with coauthors_get_avatar()

    Ive tried updating my theme with the suggestions but the picture just wont show when using “coauthors_get_avatar”

    <?php echo get_avatar( get_the_author_meta( ‘ID’ ), ’80’ ); ?>

    e.g
    <?php echo coauthors_get_avatar(get_the_author_meta( ‘ID’ ), ’80’); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_avatar() for guest author’ is closed to new replies.