• Resolved linux4me2

    (@linux4me2)


    I’m working on a site with a large number of images that link to pages on the site. I don’t want those links to open in a lightbox. The site also has single images that I want to open in a lightbox; those images have their “link to” set to “media file.” In ARI Fancy Lightbox settings, if I check “convert links to images,” the images with links to custom URLs open the page in a lightbox instead of the links opening the new page.

    I see in the documentation that I could add the class “no-lightbox” to the images with custom URLs to prevent them from opening in a lightbox, but the number of images with custom URLs, and the chance that someone will forget to add the class to new images, makes it impractical.

    Is there a better way to prevent images with custom URLs from opening in a lightbox?

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author arisoft

    (@arisoft)

    Hello

    Is it possible to see sample page(s) with the links which you want to open into the lightbox and the links which should be ignored?

    Thread Starter linux4me2

    (@linux4me2)

    Hi @arisoft, thanks for the quick reply. The problem site is a production site, and it would cause a problem with its functioning if I were to set it up so you can see the issue. Instead, I’ll set up a demo of the problem on a test site and give you a link. I’ll post back here with the link when I have it set up.

    Thread Starter linux4me2

    (@linux4me2)

    This is classic. I set up a demo on a test site, and it worked perfectly; i.e., with “convert links to images” checked, images with the “link to” set to “media file” opened in a lightbox, images with a custom URL opened the page–not in a lightbox–and gallery images opened in a lightbox. All just as it should. I used the same theme as the problem site, but not all the same plugins. It must be a plugin conflict, and not your plugin at all! When I get the chance, I’ll add each plugin to the test site that the production site has and see if I can identify the plugin that’s causing the issue. If I can I’ll post the information here.

    Plugin Author arisoft

    (@arisoft)

    If you reproduce the problem on demo site, let us know and we will help to investigate the problem.

    Thread Starter linux4me2

    (@linux4me2)

    @arisoft – I found the culprit, and it wasn’t a plugin conflict after all. The problem on the production site was caused by captions that contain hyperlinks to the same page that the images link to. I am able to reproduce the problem by adding an image with a custom URL to another page on the site, and adding a caption that contains a hyperlink to the same page. If that’s done, clicking the image opens the page in a lightbox. Clicking the link in the caption takes you to the page as it should.

    I set up a demo page to show you what I mean. If you click on the violet “Linked Image with Caption” in #3, you get the page it links to in a lightbox instead of it opening the page in the browser as it does if there is no hyperlink in the caption. If you click the link in the caption, it goes to the page as it should.

    Thread Starter linux4me2

    (@linux4me2)

    @arisoft – I didn’t mark this as resolved. I was hoping you would want to modify the plugin so it would ignore images with custom URLs that contain hyperlinks in captions. It seems like this is a bug?

    Plugin Author arisoft

    (@arisoft)

    We will fix this in the next version. Try to release it within a week.

    Thread Starter linux4me2

    (@linux4me2)

    @arisoft – Awesome! Thank you.

    Plugin Author arisoft

    (@arisoft)

    Sorry for the delay. The problem was fixed in v. 1.3.5.

    Thread Starter linux4me2

    (@linux4me2)

    No problem with the delay. I greatly appreciate your attempt to fix it. It doesn’t seem to be fixed for me, however.

    I updated the plugin to v. 1.3.5, cleared the cache on the server as well as my browser. If I try clicking on the image in #3 on my Sample Page, I still get the target page in a lightbox instead of the browser navigating to that page, when the image is linked to the same page the caption is (which works).

    Plugin Author arisoft

    (@arisoft)

    When we click by “Link to Test Gallery Page” link, it opens into a browser, not in the lightbox. Try to test it in browser’s incognito mode to avoid problem with cache.

    Thread Starter linux4me2

    (@linux4me2)

    Yes, the link “Link to Test Gallery Page” works, but the image labeled “Linked Image with Caption” is linked to the same page, and should take you to the page rather than opening the page in a lightbox. Please try clicking on the “Linked Image with Caption” image itself and see what happens.

    Plugin Author arisoft

    (@arisoft)

    Open “Advanced” tab on “ARI Fancy Lightbox -> Settings” page and populate “Custom JS code” with the following code:

    $('.wp-caption').each(function() { var $this = $(this);$this.find('a').not($this.find('.wp-caption-text A')).each(function() { var $a = $(this);if (!ARI_FANCYBOX_HELPER.isImageLink($a.attr('href'))) $a.addClass('no-lightbox'); }); });

    Thread Starter linux4me2

    (@linux4me2)

    That works!

    Are you going to incorporate that in the JS for the next version?

    Plugin Author arisoft

    (@arisoft)

    We will think about implementation it as an extra option in a future version of the plugin.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Prevent Images With Custom URL From Opening In Lightbox?’ is closed to new replies.