• Resolved Jane Milburn

    (@jane-milburn)


    Hi, I use a Twenty Seventeen child theme WordPress version 4.9.5

    I have some images in a gallery which I do not want to link to anything. Is this possible to do?

    If I set link to None in the gallery settings, there is then no link to any of the images but I do want links to some of them.

    I cannot find the answer online or in the forum so I am asking here if anyone can help.

    I know there are no link plugins but these do not seem to work for individual images.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Jane Milburn

    (@jane-milburn)

    I have now linked the images to the same page for the time being but this is not the answer for me as the page then loads again and the hand cursor shows making the image look clickable which will be confusing.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Install this Custom JS plugin: https://www.ads-software.com/plugins/custom-css-js/

    Then in the “Edit JS Code” section of the plugin dashboard, add this:

    
    var $ = jQuery,
        pageUrl = window.location.href,
        galleryLinks = $('.tiled-gallery-item a.no-lightbox');
    
    galleryLinks.each(function() {
    
        var link = $(this),
    	destination = link.attr('href'),
    	image = $('img', link);
    	
        if (destination === pageUrl) {
    	image.unwrap();
        }
    });
    
    • This reply was modified 6 years, 7 months ago by Andrew Nevins.
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I have now linked the images to the same page for the time being

    Great, that JS will only work for links that go to the same page. That’s the only way the JavaScript will know which links you don’t want to be there.

    Thread Starter Jane Milburn

    (@jane-milburn)

    Hi Andrew, I will give that a go and let you know if it works. Thank you.

    Thread Starter Jane Milburn

    (@jane-milburn)

    Thank you for your reassurance:)
    Is there any way to remove the hand cursor for just the white images? I will be adding images there at some stage but even then, I don’t want them to be clickable. Although they are now linked to the same page, it may put people off as something looks clickable but only takes them back to the same page. I would find that annoying if I visited a site that did that.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I’m not sure I understand, the code I provided not just removed the hand but removed the link. Are you saying you want the link, but want to remove the hand mouse icon?

    Thread Starter Jane Milburn

    (@jane-milburn)

    Hi Andrew, as usual i’m a bit confused myself! Maybe i’m doing something wrong? I have installed the plugin, entered the code you gave in “Edit JS Code”, updated but it doesn’t work, the link is still clickable and the hand cursor is still there. I have cleared the browser cache but still no change. Any ideas?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Oh I am sorry, I missed out an important step.

    When you’re in the plugin’s “Edit JS Code” screen, you need to set an option of “Footer” underneath the setting “Where on page”: https://ps.w.org/custom-css-js/assets/screenshot-3.jpg?rev=1770918

    Thread Starter Jane Milburn

    (@jane-milburn)

    Lol, I nearly fell off my chair with excitement. It all works! I will post on the question I asked about centering. That also worked. Thank you again Andrew for saving the day ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Remove link URL’s’ is closed to new replies.