-
Hi Team,
How can I add image alt text in the author box?
https://www.cheapmedicineshop.com/blog/eyecare/eye-strain-remedies/ -
Fernando
Hi Ansh,
If you have GB Pro, you can add an aria-label custom attribute through the Advanced options of the Block Settings: https://docs.generateblocks.com/article/custom-attributes/
You can also do it via custom PHP code with a filter like the WordPress filter
render_block
if you don’t have GB Pro. -
Thanks, Fernando,
We are not using GB pro, we are only using GP premium.
Can you please write PHP code for me?
Best Regards
-
Fernando
What I can do is provide a sample that can help you achieve what our GB Pro custom attribute feature does. See this example: https://generate.support/topic/discernible-link-name-for-dynamic-images/#post-56047:~:text=Hi%20Slaven%2C-,Can%20you%20try%20this%3F%3A,-1.%20Can%20you
Hope that helps!
-
Thanks for your reply,
Can you please provide me the code with the required changes?
I don’t have knowledge of wp functions and PHP.Best Regards
-
Hi there,
try adding this PHP Snippet to your site:
add_filter('get_avatar', function($text){ $alt = get_the_author_meta( 'display_name' ); $text = str_replace('alt=\'\'', 'alt=\'Image of '.$alt.'\' title=\'Avatar for '.$alt.'\'',$text); return $text; });
-
Thanks, David
Same issues after adding this code.
Can you please check accessibility on this page speed report?
https://pagespeed.web.dev/analysis/https-www-goodrxmedicine-com-blog-sexual-wellness-cialis-side-effects/ka0kbnddil?form_factor=mobileRegards
-
Alvind
Hi there,
May I know how you added the snippet?
-
In Function.php of Generatepress child theme.
-
You are using an image optimize plugin, which changes the HTML of the image.
I wonder if that’s the reason that the snippet doesn’t work, can you try disabling the
picture
tag in the plugin to test? -
yes,
I am using Imagify.
I just turned it off, and the picture tag is removed now.
But the same issues.
https://pagespeed.web.dev/analysis/https-www-goodrxmedicine-com-blog-sexual-wellness-cialis-side-effects/74mbtwtjjj?form_factor=mobileRegards
-
The
alt
is still not being added, I can not log into your site to check the backend, the login link returns 404.Can you check?
-
It maybe remove /blog between domain name and wp-admin.
Can you please add this manually in your addressbar?Regards
-
Hi,
The alt issue is fixed now.
Can you please check how we can fix Links that do not have a discernible name issue with the same block?Regards
-
Alvind
The issue with the discernible name should be resolved when the image has an alt tag, as it will use the alternate text as the discernible name.
-
Hi
It shows alt tag as empty tag.
Abd all images in my media library has an alt text.
Can you please check?
- You must be logged in to reply to this topic.