How to stop clicking images on Attachment page from changing pages?

Open 5 replies generalquestion
1 year ago · Last reply by Andrew Misplon 1 year ago

Hello.

When I click on an image on an attachment page, it takes me to the page of the next image. The URL of “Navigation to: URL” that can be seen in “#image-navigation.site-navigation” checked in Custom CSS is the URL of the attachment page after the Media image. Is it possible to change this, or at least set it so that it doesn’t jump to another page?

One method I was told was to use CSS


img {
pointer-events: none;
}

I tried it, but it made it impossible to use images with correct links on other pages, so this is no good.
Please tell me a good way to fix this.

Thank you in advance.

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

5
  1. Andrew Misplon Staff 1 year, 27 days ago

    Hi Toshiaki

    Thanks for getting in touch.

    If you’re able to right click in the attachment page, inspect the page source and check the body tag you’ll find CSS body classes. You can prefix your Custom CSS rule to keep it specific to the attachment page. Here is guide on prefixing rules with body classes Post: Unique Page Styling with Custom CSS Body Classes.

  2. toshiaki 1 year, 22 days ago

    Hi Andrew.

    Thanks for your reply.
    I followed your inked article and checked the CSS inspector,
    but I couldn’t find any function related to “Navigation to”.
    It seems to be something that belongs to php
    and difficult to change it.

  3. Andrew Misplon Staff 1 year, 22 days ago

    Hi, in your question you have a CSS rule. If you prefix the CSS rule with the attachment page body class, the rule will only apply to the attachment page. The attachment page body class is in the attachment page body tag which you can locate by inspecting the page source.

  4. Andrew Misplon Staff 1 year, 22 days ago
    .attachment .img {
        pointer-events: none;
    }
  5. Andrew Misplon Staff 1 year, 22 days ago

    If the above doesn’t resolve the challenge, please send a link to an attachment page you’re working on, we’ll take a look and go from there.
    Cheers!

Replies on this thread are closed.

Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Have a different question or issue?

Start New Thread