Images and other media give a website an added aesthetic value, thus generating more interest and visual appeal to your website. You can imagine a blog without featured images. However minimalistic a website is, photos always play a big role therefore images with custom links are a welcome addition.
How then do you do if you want to add links to images in a WordPress gallery?
WordPress by default doesn’t have this option available therefore if you want each image to link to a different page or post, you might not be able to do it. I would also suggest that you should not try to modify your code to make this possible, you might end up breaking the site more.
It is possible to hotlink your images using a pretty simple plugin.
In this blog, we will show you how to add a custom link to an image in WordPress galleries.
Firstly start by a quick install of the “WP Gallery Custom Links” plugin. You can the create additional fields when creating a WordPress photo gallery on your site.
The WP Gallery Custom Links plugin will add four new features to the gallery view.
- Gallery Link URL: This where you want the image to link. For example, this could be a bio page for a partner if you’re showing pictures of team members.
- Gallery Link Target: The target option lets you choose whether you want the link to open in the same window or open a new tab.
- Gallery Link OnClick Effect: From the OnClick Effect option, you can remove filters and effects that happen when an image is clicked.
- Gallery Link Additional CSS Classes: If you plan on using custom CSS for the style of the gallery, you can assign classes to specific images for further customization.
How to Add Custom Links to Single Images
Go and upload your image file using the media uploader. Once it is uploaded, you can link it to a custom URL under attachment display settings.
Wonderful!, just before you go: Please subscribe to our website for the latest tips, ideas, and recommendations to make your WordPress site wonderful.