Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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)

    View screenshot

    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.
    #462819

    Hi 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,
    Elliott

    #462846

    Hi 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;
    #463334

    Hi!

    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,
    Elliott

    #463341

    Yes 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&#8217;
    And I’m trying to make that link clickable too.

    I hope you can see how I can achieve this.

    Thanks in advance.
    Greets Mark

    #463995

    Hi!

    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,
    Elliott

    #493354

    Hi,

    I’m sorry for my late response. Thanks for your reply.
    This problem is solved, so you can close this thread.

    Greets Mark

    #493405

    Hi!

    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

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Show alt tag in lightbox instead of counter’ is closed to new replies.