Until recently, there hasn’t been a reliable plugin for linking individual gallery images to custom url’s when using the native gallery function included in the WordPress core files.
Over a year ago i wrote a tutorial about how to link NextGen gallery image titles to custom url’s which required editing the plugins files and installing a custom fields plugin for NextGen.
With the huge improvements WordPress has made in respect of the native gallery and media in general, its now easy to add custom links to each specific image you add when creating a gallery in WordPress.
[plugit]Install the WP Gallery Custom Links plugin and select or upload images to include in your gallery.[/plugit]
This plugin will enable you to insert custom links for WordPress gallery images (instead of attachment or file only).
Once you’ve selected the images to include in your gallery, add a custom link to each image under the attachment details section when creating the gallery.
Gallery Link URL
This will replace “Image File” or “Attachment Page” link for this image in galleries. Use [none] to remove the link from this image in galleries.
Gallery Link Target
This setting will be applied to this image in galleries regardless of whether or not a Gallery Link URL has been specified.
Select same window or new window.
Gallery Link On Click Effect
Lightbox and other OnClick events are removed by default from this image in galleries. This setting will only be applied to this image in galleries if this image has a Gallery Link URL specified.
Gallery Settings
Once you have created your gallery and inserted your custom links for each image, its time to insert your gallery into a page or post.
You’ll find 2 options in the gallery Settings.
- Link to Media File
- Link to Attachment Page
These settings are no longer relevant if you’ve already inserted custom links for each image in the gallery. You can now go ahead and insert your gallery shortcode anywhere in your theme.
Styling Gallery Images
You might also like to style the images you have included in your galleries.
You can change the size of each gallery image, remove or add borders to images and display your images using the gallery shortcode in a custom function using your themes hooks.
Read more about how to customize your image gallery.
If you’re currently using the NextGen gallery (NGG) plugin you may consider changing from NGG to the native gallery included in WordPress by default.
What do you think?
A pretty cool little plugin which removes the need for adding custom fields and hacking code in the core files.
Was This Tutorial Helpful?