-
AuthorPosts
-
August 6, 2018 at 8:24 pm #994071
I would love to have used a lightbox plugin to show galleries and images but I can not get any to work.
For now I can use Enfold built in modal lightbox window, but I really need to show the image title below the image but it does not show up. Then only thing seen below the image is the counter.
The site is http://www.kistefosmobler.no
How can I get the title to show up?
Regards
Nina- This topic was modified 6 years, 4 months ago by Advantage09.
August 7, 2018 at 5:17 pm #994494Anyone that can help me with this?
I have tried several lightboxes all of which say they will show the image title, or image caption. None of them does. I can not figure out what is wrong. The <div class=”mfp-title”></div> is empty.
My client uses the titles of the images in his catalog.
Anyone?
Regards
NinaAugust 8, 2018 at 4:39 am #994684Hi,
Thank you for using Enfold.
Looks like you’re using a third party plugin to display the product or the gallery images. The plugin has to render the link’s title attribute, so the lightbox can use it. That attribute is missing. Please try this in the functions.php file.
add_action('wp_footer', 'ava_add_lightbox_title', 9999); function ava_add_lightbox_title() { ?> <script> (function($) { function a() { $('.upcp-tabbed-image-container a').each(function() { var title = $(this).find('img').attr('alt'); $(this).attr('title', title); }); } a(); })(jQuery); </script> <?php }
Best regards,
IsmaelAugust 8, 2018 at 10:58 am #994834Thank you for your reply. This function is only working on the first image in gallery. The following images still has no title. The <div class=”mfp-title”></div> is still empty on the following images.
A couple of the lightboxes I have tried has produced the same result, the title of the first image, but no more.
And yes, I am using a third party plugin for the catalogue of this website, but the problems is also on Enfold galleries and here there are no first image with an image title. Like on page https://www.kistefosmobler.no/inspirasjon/
The issue with missing titles has not always been there. I had another issue with missing images a few weeks back. It was after this was resolved the problem with the missing image title appeared.
I am providing temporary login details, if you could be so kind as to take a look it would be much appreciated .
Regards
NinaAugust 9, 2018 at 8:43 am #995295Hi,
The above script gets the ALT attribute of the image inside the links and then apply it to the link itself thus enabling the lightbox to render the title. Unfortunately, some of the images don’t have an ALT attribute, so I had to get the data from the “data- ulbtitle” attribute. Again, this is not consistently available among the gallery thumbnails. How do the plugin set that attribute? You may need to edit the attributes of the images in the Media > Library panel.
Best regards,
IsmaelAugust 10, 2018 at 9:49 pm #996157Hi,
I know there are some images missing the alt attribute but not in the galleries that are most important. One gallery is from the third parity plugin. Here you can see the title of the image on the main image and then again on the first image in the gallery below. Then empty. All of these images have alt, title and caption filled out.
The link below is a masonry gallery from Enfold, just a regular gallery but no titles here either. Alt, title and caption are all filled out for these images as well.
Really not sure if the plugin sets the attribute, if it does at all.
Regards
NinaAugust 13, 2018 at 7:00 am #996543Hi,
Thanks for the update.
https://www.kistefosmobler.no/kistefos-produkter/product/heldekkende-maling/
The first thumbnail’s (Kveldshimmel_S5010-R90B) data-ulbtitle attribute is set, but the same attribute is empty on the rest of the thumbnails. The following code is the actual markup of the second thumbnail (Timian-S-6005-G80Y). As you can see, the “data-ulbtitle” attribute is empty and the image inside the link tag doesn’t have an ALT attribute. The script above requires the alt or the data-ulbtitle attribute in order for the lightbox script to render the title.
<a class="upcp-thumb-anchor lightbox-added" href="https://www.kistefosmobler.no/wp-content/uploads/2018/08/Timian-S-6005-G80Y.jpg" data-ulbsource="https://www.kistefosmobler.no/wp-content/uploads/2018/08/Timian-S-6005-G80Y.jpg" data-ulbtitle="" data-ulbdescription="" title="" style="position: relative; overflow: hidden;"><img src="https://www.kistefosmobler.no/wp-content/uploads/2018/08/Timian-S-6005-G80Y.jpg" id="prod-cat-addt-details-thumb-654" class="upcp-tabbed-addt-details-thumb " onclick="ZoomImage("86", "654"); return false;"><span class="image-overlay overlay-type-image" style="display: none;"><span class="image-overlay-inside"></span></span></a>
For the masonry element, please edit the config-templatebuilder > avia-shortcodes > av-helper-masonry.php file and then look for this code around line 370:
$linktitle = 'title="'.esc_attr($the_title).'"';
Replace it with:
$linktitle = 'title="'.esc_attr($title).'"';
Best regards,
IsmaelAugust 15, 2018 at 6:48 pm #997641you can take the caption f.e. or the title for this to show in editing ismaels code a bit:
still brainstorming :lol sorry
i tested it and now it does not work as usualbut on your page i see in your source code no title, no alt tags nor captions ! https://www.kistefosmobler.no/inspirasjon/
But why don’t you put these input fields for it – which are made for that:
- This reply was modified 6 years, 4 months ago by Guenni007.
August 16, 2018 at 5:34 am #997763Hi,
@guenni007: They’re using a third party plugin for the gallery. I don’t think it has the caption field but I could be wrong.
Best regards,
IsmaelAugust 17, 2018 at 8:23 am #998315hm – on this page ( https://www.kistefosmobler.no/inspirasjon/ ) i think they are using the enfold masonry gallery. But i could be wrong.
August 17, 2018 at 1:41 pm #998440I am testing your solution and altered the av-helper-masonry.php file. It did not change anything.
@guenni007 – the gallery in the page you are referring to is an enfold masonry gallery. The other one is a third party plugin.What surprises me is that this did work a few weeks back. We then had a script conflict with images not showing up. After this
was resolved the img title was missing. Not sure where to go from here.Thanks for your effort. Any other suggestions is appreciated.
Regards
NinaAugust 22, 2018 at 5:48 am #1000136Hi,
Sorry for late reply, the image captions in the masonry gallery lightbox should show by default. Please deactivate the third party plugin and try again. If you still have an issue, please post the WP login details in private so we can take a closer look at this issue.
Best regards,
VinayJuly 16, 2019 at 4:20 pm #1119185Hi all,
In all my websites using the Enfold lightbox showed the image Caption. After upgrades to WordPress 5.2.2 and Enfold 4.5.7, all the lightboxes now show the Title. See the link to screenshots. The website I’m using as an example has no plugins installed.
Is there a setting somewhere we are missing?
Thanks
July 19, 2019 at 10:51 am #1120132Hi,
@fulanoinc: The image title is the one that’s supposed to display in that area, not the caption. It’s been that way ever since, so I’m not sure how you managed to display the caption before. Please create your own ticket and post the necessary details in the private field.Best regards,
Ismael -
AuthorPosts
- The topic ‘Showing image title in lightbox’ is closed to new replies.