• Resolved fhwebdesign

    (@fhwebdesign)


    While using this plugin, no alt attribute with text is used.
    It would be great if you could integrate a function to set an alt attribute by text input or by the alt attribute of that image in media library.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Contributor Jeffrey Paul

    (@jeffpaul)

    @fhwebdesign when you select an image you should see an “Alt Text” field on the right hand side in the “Attachment Details” section above the “Set as avatar” button. If you do not see that, can you please share you WordPress and Simple Local Avatars versions so I can see what may not be working correctly?

    Thread Starter fhwebdesign

    (@fhwebdesign)

    @jeffpaul
    Hi, thanks for your quick reply.
    In the media library, an alt text is set. But, on my page, the image has an empty alt attribute.

    WP version: 5.8
    Simple Local Avatars version 2.2.0

    Plugin Contributor Jeffrey Paul

    (@jeffpaul)

    @fhwebdesign mind confirming your theme so we can test there as well?

    Thread Starter fhwebdesign

    (@fhwebdesign)

    @jeffpaul
    Here you go, but it’s a paid theme. It’s called ‘TM Heli’.
    If you want I can setup a test environment for you.

    I just checked, it seems like because in the includes/class-simple-local-avatars.php, the get_simple_local_avatar() function gets called without any parameters, so the alt attribute gets defaulted to ” (as you can see in simple-local-avatars.php)

    • This reply was modified 3 years, 2 months ago by fhwebdesign.
    • This reply was modified 3 years, 2 months ago by fhwebdesign.
    Thread Starter fhwebdesign

    (@fhwebdesign)

    @jeffpaul
    To verify, I just tested it with the free ‘BusiCare Dark’ theme.
    With this theme, I also can reproduce this problem.

    What are your next steps?

    Plugin Contributor Jeffrey Paul

    (@jeffpaul)

    @fhwebdesign next step would be opening an issue in our GitHub repo documenting what you’re seeing. From there if someone in the community is able to submit a pull request then I could get it reviewed quickly and into a minor release. Otherwise our team is rather booked with other projects and unlikely to be free to come back to this until later this year.

    Thread Starter fhwebdesign

    (@fhwebdesign)

    @jeffpaul
    Thanks for the update.
    Is this repo the correct one?
    https://github.com/10up/simple-local-avatars

    EDIT:
    I found a better solution:

    /*	Enable ALT for Avatars	*/
    add_filter( 'get_avatar', 'fh_set_avatar_alt' );
    function fh_set_avatar_alt( $avatar ) {
    	if( have_comments() ) {
    		$alt = get_comment_author();
    	}
    	else {
    		$alt = get_the_author_meta( 'display_name' );
    	}
    	$avatar = str_replace( 'alt=\'\'', 'alt=\'Avatar for ' . $alt . '\'', $avatar );
    	return $avatar;
    }
    • This reply was modified 3 years, 2 months ago by fhwebdesign.
    Plugin Contributor Jeffrey Paul

    (@jeffpaul)

    @fhwebdesign yes that’s the correct GitHub repository.

    Hello

    First of all thanks for your useful plugin.
    I have the same problem with the plugin. In the RankMath SEO tool plugin there’s 3 errors related to images without alt. All of my images have alt text in the media library but I don’t know why it’s shows this error yet. Help me please.

    Error listed:

    Some images on your page have no alt attribute. (3)
    
    <img alt="" src="h.../uploads/2021/02/irpt--96x96.png" srcset=".../uploads/2021/02/irpt--192x192.png 2x" class="avatar avatar-96 photo" height="96" width="96" loading="lazy">
    
    <img alt="" src="https://secure.gravatar.com/avatar/4b9ec6af010165843bc4ceb49ced212c?s=96&d=mm&r=g" srcset="https://secure.gravatar.com/avatar/4b9ec6af010165843bc4ceb49ced212c?s=192&d=mm&r=g 2x" class="avatar avatar-96 photo" height="96" width="96" loading="lazy">
    
    <img alt="" src=".../uploads/2021/02/irpt--96x96.png" srcset=".../uploads/2021/02/irpt--192x192.png 2x" class="avatar avatar-96 photo" height="96" width="96" loading="lazy">

    Thanks and regards.

    Plugin Contributor Jeffrey Paul

    (@jeffpaul)

    @alikit what field is RankMath looking for alt text in?

    Hello,

    In the SEO Analyze Tool (Image ALT Attributes section).

    Plugin Contributor Jeffrey Paul

    (@jeffpaul)

    @alikit is that a WP core field for media or something custom for RankMath?

    It’s a custom for RankMath, although I solved the problem with activate “Auto fill missing image alt add-on” in the same RankMath.

    Thanks and regards.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Add alt to image’ is closed to new replies.