Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #489112

    Hi,

    I’m struggling with something pretty basic, though I can’t find out how to manage this.
    In the image masonry gallery, when you hover over the image you see the yellow alt text.

    Now this displays the caption. I want this to display the image alternative text or title.

    see here in the image. It displays the caption. Instead it should show the title or alternative text of the image. In this case “Marathon”.

    The caption when seeing the image in the lightbox should remain as it is now:

    I understand it is done in the masonry_entries.php, around line 600, but can’t manage to edit the code to achieve this.
    Can you help me out?

    Thanks

    S

    • This topic was modified 9 years, 3 months ago by Spiv.
    #489990

    Hey Spiv!

    Please go to Enfold/config-templatebuilder/avia-shortcodes folder and open masonry_entries.php file and find

    
    
    
    $img_html  = '<img src="'.$attachment[0].'" title="'.$title.'" alt="'.$alt.'" />';
    

    and change it to

    
    
    
    $img_html  = '<img src="'.$attachment[0].'" alt="'.$alt.'" />';
    

    Best regards,
    Yigit

    • This reply was modified 9 years, 3 months ago by Yigit.
    #490367

    Hi Yigit,

    I tried this, but it doesn’t work.
    The problem is the alt of the image is not shown in the yellow tip, but the title of the caption in the a tag. Now you just removed the title attribute in the img tag.

    <a style="position: absolute; left: 0px; top: 0px;"... title="Marathon <br>50x180cm, foil on forex panel" itemprop="contentURL"><div class="av-inner-masonry-sizer"></div><figure class="av-inner-masonry main_color"><div class="av-masonry-outerimage-container"><div class="av-masonry-image-container" style="background-image: url(https://blabla.jpg);"><img src="blabla.jpg.jpg" alt="Marathon"></div></div></figure></a>

    This is really a concern as html is not rendered in these browser tooltips (hence I see html tags in the tooltip) and a caption should not be shown there. Some captions are really large. These tooltips should show the alt of the img. As you see this is nicely set at “Marathon”.

    What could be a solution for this?

    Thank you.

    • This reply was modified 9 years, 3 months ago by Spiv.
    #490373

    Got it. The trick was (and I think you might correct this for future releases) to do this:

    $img_style = 'style="background-image: url('.$attachment[0].');" title="'.$alt.'"';

    This overrides the title attribute in the outer a tag with the alt given to the image.

    Thanks for pointing me in the right direction though :)

    Cheers!

    #490380

    Hi!

    Glad you figured it out! :)

    Cheers!
    Yigit

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