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.
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.
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.
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.
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!