• Resolved dgold75

    (@dgold75)


    Hello,
    after last update of WPbakery, images show image name instead of alt text.
    Images inserted directly into the text show alt text properly. Can you help, pls?
    David

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter dgold75

    (@dgold75)

    example what happens:
    example page

    Hi, you could remove (or change) the title on your Media Library admin page…

    Thread Starter dgold75

    (@dgold75)

    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 2 years, 10 months ago by dgold75.
    • This reply was modified 2 years, 10 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)

    Thread Starter dgold75

    (@dgold75)

    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)…

    Thread Starter dgold75

    (@dgold75)

    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?

    Thread Starter dgold75

    (@dgold75)

    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

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘ALT text in WPbakery’ is closed to new replies.