WP Gallery Custom Links - Version 1.6.1

Version Description

  • 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
Download this release

Release Info

Developer fourlightsweb
Plugin Icon wp plugin WP Gallery Custom Links
Version 1.6.1
Comparing to
See all releases

Code changes from version 1.6.0 to 1.6.1

Files changed (2) hide show
  1. readme.txt +17 -1
  2. wp-gallery-custom-links.php +14 -8
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-li
4
  Tags: gallery links, gallery link, gallery
5
  Requires at least: 3.3.2
6
  Tested up to: 3.5.1
7
- Stable tag: 1.6.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -82,6 +82,12 @@ Check your HTML and CSS for these changes and adjust accordingly.
82
 
83
  == Changelog ==
84
 
 
 
 
 
 
 
85
  = 1.6.0 =
86
  * By popular demand, added the ability to remove links from individual images
87
  or an entire gallery.
@@ -145,6 +151,16 @@ directly attached to the post.
145
 
146
  == Upgrade Notice ==
147
 
 
 
 
 
 
 
 
 
 
 
148
  = 1.5.1 =
149
  * Fixed a possible error with an undefined "preserve_click" variable.
150
 
4
  Tags: gallery links, gallery link, gallery
5
  Requires at least: 3.3.2
6
  Tested up to: 3.5.1
7
+ Stable tag: 1.6.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
82
 
83
  == Changelog ==
84
 
85
+ = 1.6.1 =
86
+ * Fixed an issue where items with the same custom link were not having lightbox
87
+ removed properly
88
+ * Added support for the "ids" attribute added in WP 3.5
89
+ * Updated help text for the Gallery Link URL field
90
+
91
  = 1.6.0 =
92
  * By popular demand, added the ability to remove links from individual images
93
  or an entire gallery.
151
 
152
  == Upgrade Notice ==
153
 
154
+ = 1.6.1 =
155
+ * Fixed an issue where multiple items with the same custom links were not having lightbox
156
+ removed properly
157
+ * Added support for the "ids" attribute added in WP 3.5
158
+ * Updated help text for the Gallery Link URL field
159
+
160
+ = 1.6.0 =
161
+ * By popular demand, added the ability to remove links from individual images
162
+ or an entire gallery.
163
+
164
  = 1.5.1 =
165
  * Fixed a possible error with an undefined "preserve_click" variable.
166
 
wp-gallery-custom-links.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Gallery Custom Links
4
  Plugin URI: http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-links/
5
  Description: Specifiy custom links for WordPress gallery images (instead of attachment or file only).
6
- Version: 1.6.0
7
  Author: Four Lights Web Development
8
  Author URI: http://www.fourlightsweb.com
9
  License: GPL2
@@ -66,7 +66,7 @@ class WPGalleryCustomLinks {
66
  'label' => __( 'Gallery Link URL' ),
67
  'input' => 'text',
68
  'value' => get_post_meta( $post->ID, '_gallery_link_url', true ),
69
- 'helps' => 'Will replace "Image File" or "Attachment Page" link for this image in the gallery.'
70
  );
71
  $target_value = get_post_meta( $post->ID, '_gallery_link_target', true );
72
  $form_fields['gallery_link_target'] = array(
@@ -159,6 +159,9 @@ class WPGalleryCustomLinks {
159
  if( isset( $attr['include'] ) ) {
160
  $attachment_ids = array_merge( $attachment_ids, explode( ',', $attr['include'] ) );
161
  }
 
 
 
162
  foreach ( $attachment_ids as $attachment_id ) {
163
  $link = '';
164
  $target = '';
@@ -287,15 +290,18 @@ class WPGalleryCustomLinks {
287
 
288
  // Custom Link
289
  if( $custom_link != '' && ! $remove_link ) {
290
- // If we found the href to swap out, perform the href replacement,
291
- // and add some javascript to prevent lightboxes from kicking in
292
- $output = preg_replace( $needle, 'href="' . $custom_link . '"', $output );
293
-
294
  // Add a class to the link so we can manipulate it with
295
- // javascript later
 
 
 
296
  if( $preserve_click != 'preserve' ) {
297
- $output = self::add_class( $custom_link, 'no-lightbox', $output );
298
  }
 
 
 
 
299
  } // End if we have a custom link to swap in
300
  } // End if we found the attachment to replace in the output
301
 
3
  Plugin Name: WP Gallery Custom Links
4
  Plugin URI: http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-links/
5
  Description: Specifiy custom links for WordPress gallery images (instead of attachment or file only).
6
+ Version: 1.6.1
7
  Author: Four Lights Web Development
8
  Author URI: http://www.fourlightsweb.com
9
  License: GPL2
66
  'label' => __( 'Gallery Link URL' ),
67
  'input' => 'text',
68
  'value' => get_post_meta( $post->ID, '_gallery_link_url', true ),
69
+ 'helps' => 'Will replace "Image File" or "Attachment Page" link for this image in the gallery. Use [none] to remove the link from this image.'
70
  );
71
  $target_value = get_post_meta( $post->ID, '_gallery_link_target', true );
72
  $form_fields['gallery_link_target'] = array(
159
  if( isset( $attr['include'] ) ) {
160
  $attachment_ids = array_merge( $attachment_ids, explode( ',', $attr['include'] ) );
161
  }
162
+ if( isset( $attr['ids'] ) ) { // Added in WP 3.5
163
+ $attachment_ids = array_merge( $attachment_ids, explode( ',', $attr['ids'] ) );
164
+ }
165
  foreach ( $attachment_ids as $attachment_id ) {
166
  $link = '';
167
  $target = '';
290
 
291
  // Custom Link
292
  if( $custom_link != '' && ! $remove_link ) {
 
 
 
 
293
  // Add a class to the link so we can manipulate it with
294
+ // javascript later.
295
+ // Doing this first in case we have the same custom link
296
+ // on multiple items, in which case that class would be added
297
+ // to the first item/all items multiple times.
298
  if( $preserve_click != 'preserve' ) {
299
+ $output = self::add_class( $default_link, 'no-lightbox', $output );
300
  }
301
+
302
+ // If we found the href to swap out, perform the href replacement,
303
+ // and add some javascript to prevent lightboxes from kicking in
304
+ $output = preg_replace( $needle, 'href="' . $custom_link . '"', $output );
305
  } // End if we have a custom link to swap in
306
  } // End if we found the attachment to replace in the output
307