-
AuthorPosts
-
June 22, 2015 at 11:30 am #462572
Hi Kriesi,
In our portfolio page we use the lightbox feature. When we show a website image in the lightbox we would display the (working) URL of that website in the lightbox. It would be nice if that URL is displayed at the place where the counter is displayed. (See screenshot below)
First I was looking at the file jquery.magnific-popup.min.js
I see the counter is displayed at line 1165 (‘<div class=”mfp-counter”></div>’+)But I can’t place the wordpress tag code at this place.
$alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); if(count($alt)) echo $alt;
Can you tell me how I can achieve this?
Greets Mark
- This topic was modified 9 years, 6 months ago by Mark_goessens.
June 22, 2015 at 3:11 pm #462819Hi Mark_goessens!
You cannot use PHP inside a javascript file. You can grab more information about the image with javascript though. See here, https://kriesi.at/support/topic/social-sharing-on-galleries-enfold-v-3-0-2/#post-344775.
Best regards,
ElliottJune 22, 2015 at 3:49 pm #462846Hi Elliott,
Thanks for you quick reply. So I guess I have to put the alt tag in an iframe?
I really have no idea how I can do that. Because when I can’t add PHP this code still isn’t allowed:$alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); if(count($alt)) echo $alt;
June 23, 2015 at 1:27 pm #463334Hi!
Your trying to display the alt text correct? Do you have the text actually set in the alt attribute of the image? If so then we can grab it with javascript. Send us a link to your page so we can take a closer look.
Regards,
ElliottJune 23, 2015 at 1:36 pm #463341Yes I put a text at the alt attribute of the image. This is the link of the page: http://www.c-community.com/portfolio-item/van-aarsen-international/
I only placed an alt tag at the website visual; so the iMac with the chickens on it.When it works you should see the text: ‘http://www.aarsen.com’
And I’m trying to make that link clickable too.I hope you can see how I can achieve this.
Thanks in advance.
Greets MarkJune 24, 2015 at 1:34 pm #463995Hi!
I don’t see the alt text set in your source code but the title text is set. To the popup text to grab the image title or alt text then you would change the line like so.
return encodeURIComponent(item.el.find('img').attr('alt'));
Or for the title..
return title;
Regards,
ElliottAugust 26, 2015 at 8:56 am #493354Hi,
I’m sorry for my late response. Thanks for your reply.
This problem is solved, so you can close this thread.Greets Mark
August 26, 2015 at 10:31 am #493405Hi!
glad Elliott could help. Let us know in a new ticket if you have some more questions related to the theme. We are happy to assist you.
Cheers!
Andy -
AuthorPosts
- The topic ‘Show alt tag in lightbox instead of counter’ is closed to new replies.