WP Gallery Custom Links - Version 1.1.1

Version Description

  • Fixed an error that occurred when an images were small enough to only have one size
  • Tested with WordPress 3.4
Download this release

Release Info

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

Code changes from version 1.1.0 to 1.1.1

Files changed (2) hide show
  1. readme.txt +10 -2
  2. wp-gallery-custom-links.php +10 -6
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: fourlightsweb
3
  Donate link: http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-links/#donate
4
  Tags: gallery links, gallery link, gallery
5
  Requires at least: 3.3.2
6
- Tested up to: 3.3.2
7
- Stable tag: 1.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -38,6 +38,10 @@ As soon as someone asks me something. :)
38
 
39
  == Changelog ==
40
 
 
 
 
 
41
  = 1.1.0 =
42
  * Added support for replacing links to all sizes of an uploaded image instead of the full version only
43
  * Replaced lightbox removal with a more advanced javascript method
@@ -62,6 +66,10 @@ As soon as someone asks me something. :)
62
 
63
  == Upgrade Notice ==
64
 
 
 
 
 
65
  = 1.1.0 =
66
  * Added support for replacing links to all sizes of an uploaded image instead of the full version only
67
  * Replaced lightbox removal with a more advanced javascript method
3
  Donate link: http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-links/#donate
4
  Tags: gallery links, gallery link, gallery
5
  Requires at least: 3.3.2
6
+ Tested up to: 3.4
7
+ Stable tag: 1.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
38
 
39
  == Changelog ==
40
 
41
+ = 1.1.1 =
42
+ * Fixed an error that occurred when an images were small enough to only have one size
43
+ * Tested with WordPress 3.4
44
+
45
  = 1.1.0 =
46
  * Added support for replacing links to all sizes of an uploaded image instead of the full version only
47
  * Replaced lightbox removal with a more advanced javascript method
66
 
67
  == Upgrade Notice ==
68
 
69
+ = 1.1.1 =
70
+ * Fixed an error that occurred when an images were small enough to only have one size
71
+ * Tested with WordPress 3.4
72
+
73
  = 1.1.0 =
74
  * Added support for replacing links to all sizes of an uploaded image instead of the full version only
75
  * Replaced lightbox removal with a more advanced javascript method
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.1.0
7
  Author: Four Lights Web Development
8
  Author URI: http://www.fourlightsweb.com
9
  License: GPL2
@@ -138,11 +138,15 @@ class WPGalleryCustomLinks {
138
  // Replace all possible file sizes - some themes etc.
139
  // may use sizes other than the full version
140
  $attachment_metadata = wp_get_attachment_metadata( $attachment_id );
141
- $attachment_sizes = $attachment_metadata['sizes'];
142
- foreach( $attachment_sizes as $attachment_size => $attachment_info ) {
143
- list( $needle ) = wp_get_attachment_image_src( $attachment_id, $attachment_size );
144
- $output = self::replace_link( $needle, $link, $output );
145
- }
 
 
 
 
146
  } // End if we have a custom url to swap in
147
  } // End foreach post attachment
148
 
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.1.1
7
  Author: Four Lights Web Development
8
  Author URI: http://www.fourlightsweb.com
9
  License: GPL2
138
  // Replace all possible file sizes - some themes etc.
139
  // may use sizes other than the full version
140
  $attachment_metadata = wp_get_attachment_metadata( $attachment_id );
141
+ if( $attachment_metadata !== false && isset( $attachment_metadata['sizes'] ) ) {
142
+ $attachment_sizes = $attachment_metadata['sizes'];
143
+ if( is_array( $attachment_sizes ) && count( $attachment_sizes ) > 0 ) {
144
+ foreach( $attachment_sizes as $attachment_size => $attachment_info ) {
145
+ list( $needle ) = wp_get_attachment_image_src( $attachment_id, $attachment_size );
146
+ $output = self::replace_link( $needle, $link, $output );
147
+ } // End of foreach attachment size
148
+ } // End if we have attachment sizes
149
+ } // End if we have attachment metadata (specifically sizes)
150
  } // End if we have a custom url to swap in
151
  } // End foreach post attachment
152