[Resolved] Adding alt tag to Author images

Home Forums Support [Resolved] Adding alt tag to Author images

Home Forums Support Adding alt tag to Author images

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1299689
    Nicholas

    Hi there!

    I’m trying to add alt tags to the author images on our site. I’ve been able to do so in a custom author box, but on the author archive pages I’m not sure how I do this.

    This is the code I have for the post author box:

    <?php

    global $post;

    ?>

    <?php $alt = get_the_author_meta(‘display_name’); ?>

    <?php echo get_avatar( get_the_author_meta( ‘ID’ ), ’95’, ”, $alt ); ?>
    <h5 class=”author-title”><?php printf( esc_attr__( ‘%s’, ‘the author’ ), get_the_author_meta( ‘display_name’) );?></h5>

    <p class=”author-description”><?php echo wp_kses( get_the_author_meta( ‘description’ ), null ); ?></p>

    So as you can see I use the author name as the alt tag.

    When I inspect the author archive images, this is the result:

    How can I add a similar alt tag in the archive page?

    Thanks!

    #1299721
    Nicholas
    #1299912
    Tom
    Lead Developer
    Lead Developer

    Thanks for posting the solution! 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.