WP Gallery Custom Links

Wordpress Plugin
Download latest - 1.12

Developers

johnogg
fourlightsweb

Download Stats

Today 88
Yesterday 181
Last Week 1,164
All Time 314,141
Banner 772x250

Overview

If you've ever had a WordPress gallery of staff, product, or other images and needed to link them to other pages but couldn't, this plugin is for you!

This plugin adds a "Gallery Link URL" field when editing images. If the image is included in a gallery, the "Gallery Link URL" value will be used as the link on the image instead of the raw file or the attachment post. There are also several additional options (see "Usage" below).

It's designed to work even if customizations have been made via the post_gallery filter; instead of replacing the entire post_gallery function, it calls the normal function and simply replaces the link hrefs in the generated output. By default, any Lightbox or other onClick events on custom links will be removed to allow them to function as regular links.

Usage

  • See the custom fields added in the screenshots section at http://wordpress.org/extend/plugins/wp-gallery-custom-links/screenshots/.
  • For each gallery image, you can specify a custom Gallery Link URL.
  • Use "[none]" as the Gallery Link URL to remove the link for that gallery image.
  • For each gallery image, you can select a Gallery Link Target ("Same Window" or "New Window").
  • For each gallery image, you can select how to handle Lightbox and other onClick events ("Remove" or "Keep").
  • For each gallery link, you can add additional css classes.
  • Use [gallery ignore_gallery_link_urls="true"] to ignore the custom links on an entire gallery.
  • Use [gallery open_all_in_new_window="true"] and [gallery open_all_in_same_window="true"] to open all images in an entire gallery in a new window/the same window, respectively.
  • Use [gallery preserve_click_events="true"] to keep Lightbox or other onClick events on all custom-linked images in an entire gallery.
  • Use [gallery remove_links="true"] to remove links on all images in an entire gallery.
  • Use [gallery rel="nofollow"] to set a rel attribute with value "nofollow" on all links in an entire gallery.

Hooks

  • Use "wpgcl_filter_raw_gallery_link_url" to filter the custom gallery link URLs as they come out of the database. Note that this may include the value "[none]" if it has been entered to remove the link later on. Example:

add_filter( 'wpgcl_filter_raw_gallery_link_url', 'my_gallery_link_url_filter', 10, 3 ); function my_gallery_link_url_filter( $link, $attachment_id, $post_id ) { return '/en/' . $link; }


Releases (30 )

Version Release Date Change Log
1.12 2017-01-31
  • Fixed issue with links not showing when using WP_Tiles in later versions of Wordpress.
  • Tested with WordPress 4.7.2
1.11 2017-01-04
  • By popular demand, added the ability to set a "rel" property on all images in a gallery (e.g. nofollow)
  • Tested with WordPress 4.4
1.10.5 2015-09-30
  • Changed translation text domain from a variable to strings, because apparently a variable doesn't universally work no matter how smart it makes me feel.
1.10.4 2015-09-30
  • Updated some text domain settings to be in accordance with the translate.wordpress.org translation system.
  • Polished up some of the help message styles to make them easier to read
  • Tested with WordPress 4.3
1.10.3 2015-04-23
  • Added a "Do Not Change" default target option to improve performance by reducing the number of regexes to apply "self" on every gallery item. If your theme opens all gallery items in a new window by default and you prefer to keep them in the same window, you will need to add openall_in_same_window="true" to your gallery shortcode.
1.10.2 2015-04-22
  • Added a translation for Portuguese, courtesy of Carlos Jordo (thanks!)
  • Added the U ungreedy modifier to regular expressions to attempt to resolve occasional not-easily-reproduced blank page issues
  • Tested with WordPress 4.2
1.10.1 2014-08-28
  • Changed javascript to queue in wp_enqueue_scripts hook instead of the all-encompassing init.
  • Added a translation for Spanish, courtesy of Andrew Kurtis of WebHostingHub (thanks!)
1.10.0 2014-03-30
  • By popular demand, added the ability to add additional css classes to each image link in the gallery.
  • Added a translation for German, courtesy of Martin Stehle (thanks!)
1.9.0 2014-01-03
  • By popular demand, moved the help notes under each field into tooltips so the form won't be so tall.
  • The javascript that attempts to disable lightboxes now runs in window.onload in addition to document.ready. Hopefully this will cut down on some of the issues where lightboxes keep popping up without having to mess with javascript dependencies at the code level. Any other window.onload function should be preserved.
  • Added a javascript function detect for jQuery's off() function, since it only came into existence in 1.7. If off() isn't defined, unbind() is called instead.
  • Resolved an issue where making an image have no link occasionally resulted in all previous images in the gallery disappearing from the display.
  • Added a translation for Polish, courtesy of Przemyslaw Trawicki (thanks!)
1.8.0 2013-08-05
  • By popular demand, added a new filter on each link value: wpgcl_filter_raw_gallery_link_url
1.7.1 2013-03-23
  • A few performance increases
1.7.0 2013-03-22
  • By popular demand, added support for the "open_all_in_new_window" and "open_all_in_same_window" gallery shortcode attributes to set all images in a gallery to open in a new/the same window, respectively.
  • By popular demand, made it so "Same Window" will set the target to "_self", thus forcing the same window, instead of doing whatever the theme does by default.
1.6.1 2013-02-06
  • Fixed an issue where items with the same custom link were not having lightbox removed properly
  • Added support for the "ids" attribute added in WP 3.5
  • Updated help text for the Gallery Link URL field
1.6.0 2013-01-28
  • By popular demand, added the ability to remove links from individual images or an entire gallery.
1.5.1 2013-01-24
  • Fixed a possible error with an undefined "preserve_click" variable.
1.5.0 2013-01-22
  • By popular demand, added support for Jetpack tiled galleries (and its use of the Photon CDN for URLs).
1.4.0 2013-01-04
  • By popular demand, added an option to remove or keep Lightbox and other OnClick events ("remove" by default).
  • Added support for the "preserve_click_events" gallery shortcode attribute to set all custom-linked images in a gallery to "preserve" its OnClick events.
1.3.0 2012-12-11
  • Added support for the "ignore_gallery_link_urls" gallery shortcode attribute to ignore custom links on a gallery and use the normal file/attachment setting.
  • Added support for IDs in the "include" gallery shortcode attribute that aren't directly attached to the post.
1.2.2 2012-08-29
  • Moved javascript to a separate file so jquery could be required as a dependency.
1.2.1 2012-08-25
  • Fixed a bug where javascript hover effects were not working properly on images.
1.2.0 2012-08-23
  • By popular demand, added an option to open gallery image links in a new window.
1.1.2 2012-07-17
  • Added a check to prevent javascript from showing up in feeds.
1.1.1 2012-06-13
  • Fixed an error that occurred when an images were small enough to only have one size
  • Tested with WordPress 3.4
1.1.0 2012-06-11
  • Added support for replacing links to all sizes of an uploaded image instead of the full version only
  • Replaced lightbox removal with a more advanced javascript method
1.0.5 2012-06-07
  • Moving the $post_id code above first_call to avoid messing that up if a return does occur due to a missing post_id
1.0.4 2012-06-07
  • The "id" attribute of the gallery shortcode is now supported
1.0.3 2012-06-07
  • Added a check to return a simple space in the event $post is undefined
1.0.2 2012-06-07
  • Fixed an issue with two undefined variables
1.0.1 2012-06-03
  • Changed priority on post_gallery filter from 10 to 999 to help ensure it runs after anything else
1.0.0 2012-06-03
  • Initial release

=