example what happens:
example page
Hi, you could remove (or change) the title on your Media Library admin page…
That works, but is there any other way? I have hundreds of images…
The image on the page has correct ALT text. When its shown in a lightbox, ALT text content is somehow substituted with IMAGE title
Thank you, David
-
This reply was modified 4 years, 5 months ago by
dgold75.
-
This reply was modified 4 years, 5 months ago by
dgold75.
Currently, the light box script tries the title attribute for the Image Title first. Only if there is no title attribute (in the page source, not in the WP admin), it will fall back to the alt attribute.
There is currently no easy fix for this.
The only way (except modifying or deleting all image titles in the admin) would be to put a small javascript snippet in your footer widgets that modifies the title/alt attributes of any images on the page, just before the light box script runs.
Something like:
<script>
jQuery('img').each(function () {
$this = $(this);
if ($this.attr('alt')) {
$this.attr('title', $this.attr('alt'));
}
})
</script>
Try that in an HTML or CODE widget (not sure what is available in WPBakery)
Thank you , but the script didn´t help. I wrote to WPB support, something must have changed there. I tried older WPB version and it works fine with current version of Easy Fancybox.
Have a nice day, David
Where did you place the script? It must be placed after the content but before the light box script (inserted at wp_footer() usually in the footer.php template)…
The script is inserted via hook (GeneratePress) on the line 1102
view-source:https://www.stroke-manual.com/test1/
still no change .. is the position Ok?
David
The position seems OK but the opening <script> and closing </script> tags are missing which transforms the javascript into plain text.
Does the GeneratePress hook allow HTML tags?
I used slightly different script and entered it via code snippet
<script>
jQuery(‘img’).each(function() {
jQuery(this).attr(‘title’, jQuery(this).attr(‘alt’));
})
</script>`
Now it works perfectly. Thanks for your time and efort. I love your plugin
David