Multiple Post Thumbnails - Version 1.6.4

Version Description

Download this release

Release Info

Developer chrisscott
Plugin Icon wp plugin Multiple Post Thumbnails
Version 1.6.4
Comparing to
See all releases

Code changes from version 1.6.3 to 1.6.4

css/multi-post-thumbnails-admin.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ img.mpt-thumbnail {
2
+ width: 100%;
3
+ height: auto;
4
+ }
multi-post-thumbnails.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Multiple Post Thumbnails
4
  Plugin URI: http://wordpress.org/extend/plugins/multiple-post-thumbnails/
5
  Description: Adds the ability to add multiple post thumbnails to a post type.
6
- Version: 1.6.3
7
  Author: Chris Scott
8
  Author URI: http://voceplatforms.com/
9
  */
@@ -184,6 +184,8 @@ if (!class_exists('MultiPostThumbnails')) {
184
  wp_enqueue_script( "mpt-featured-image", $this->plugins_url( 'js/multi-post-thumbnails-admin.js', __FILE__ ), array( 'jquery', 'set-post-thumbnail' ) );
185
  wp_enqueue_script( "mpt-featured-image-modal", $this->plugins_url( 'js/media-modal.js', __FILE__ ), array( 'jquery', 'media-models' ) );
186
  }
 
 
187
  }
188
 
189
  public function admin_header_scripts() {
@@ -394,10 +396,14 @@ if (!class_exists('MultiPostThumbnails')) {
394
  if ($thumbnail_id && get_post($thumbnail_id)) {
395
  $old_content_width = $content_width;
396
  $content_width = 266;
397
- if ( !isset($_wp_additional_image_sizes["{$this->post_type}-{$this->id}-thumbnail"]))
398
- $thumbnail_html = wp_get_attachment_image($thumbnail_id, array($content_width, $content_width));
399
- else
400
- $thumbnail_html = wp_get_attachment_image($thumbnail_id, "{$this->post_type}-{$this->id}-thumbnail");
 
 
 
 
401
  if (!empty($thumbnail_html)) {
402
  $content = sprintf($set_thumbnail_link, $thumbnail_html);
403
  $format_string = '<p class="hide-if-no-js"><a href="#" id="remove-%1$s-%2$s-thumbnail" onclick="MultiPostThumbnails.removeThumbnail(\'%2$s\', \'%1$s\', \'%4$s\');return false;">%3$s</a></p>';
@@ -405,11 +411,11 @@ if (!class_exists('MultiPostThumbnails')) {
405
  }
406
  $content_width = $old_content_width;
407
  }
408
-
409
  if (version_compare($wp_version, '3.5', '>=')) {
410
  $content .= sprintf('<script>%s</script>', $modal_js);
411
  }
412
-
413
  return apply_filters( sprintf( '%s_%s_admin_post_thumbnail_html', $this->post_type, $this->id ), $content, $post_ID, $thumbnail_id );
414
  }
415
 
3
  Plugin Name: Multiple Post Thumbnails
4
  Plugin URI: http://wordpress.org/extend/plugins/multiple-post-thumbnails/
5
  Description: Adds the ability to add multiple post thumbnails to a post type.
6
+ Version: 1.6.4
7
  Author: Chris Scott
8
  Author URI: http://voceplatforms.com/
9
  */
184
  wp_enqueue_script( "mpt-featured-image", $this->plugins_url( 'js/multi-post-thumbnails-admin.js', __FILE__ ), array( 'jquery', 'set-post-thumbnail' ) );
185
  wp_enqueue_script( "mpt-featured-image-modal", $this->plugins_url( 'js/media-modal.js', __FILE__ ), array( 'jquery', 'media-models' ) );
186
  }
187
+
188
+ wp_enqueue_style( "mpt-admin-css", $this->plugins_url( 'css/multi-post-thumbnails-admin.css', __FILE__ ) );
189
  }
190
 
191
  public function admin_header_scripts() {
396
  if ($thumbnail_id && get_post($thumbnail_id)) {
397
  $old_content_width = $content_width;
398
  $content_width = 266;
399
+ $attr = array( 'class' => 'mpt-thumbnail' );
400
+
401
+ if ( !isset($_wp_additional_image_sizes["{$this->post_type}-{$this->id}-thumbnail"])) {
402
+ $thumbnail_html = wp_get_attachment_image( $thumbnail_id, array($content_width, $content_width), false, $attr );
403
+ } else {
404
+ $thumbnail_html = wp_get_attachment_image( $thumbnail_id, "{$this->post_type}-{$this->id}-thumbnail", false, $attr );
405
+ }
406
+
407
  if (!empty($thumbnail_html)) {
408
  $content = sprintf($set_thumbnail_link, $thumbnail_html);
409
  $format_string = '<p class="hide-if-no-js"><a href="#" id="remove-%1$s-%2$s-thumbnail" onclick="MultiPostThumbnails.removeThumbnail(\'%2$s\', \'%1$s\', \'%4$s\');return false;">%3$s</a></p>';
411
  }
412
  $content_width = $old_content_width;
413
  }
414
+
415
  if (version_compare($wp_version, '3.5', '>=')) {
416
  $content .= sprintf('<script>%s</script>', $modal_js);
417
  }
418
+
419
  return apply_filters( sprintf( '%s_%s_admin_post_thumbnail_html', $this->post_type, $this->id ), $content, $post_ID, $thumbnail_id );
420
  }
421
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: chrisscott, voceplatforms
3
  Tags: thumbnails, image, featured image
4
  Requires at least: 2.9.2
5
  Tested up to: 4.0
6
- Stable tag: 1.6.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
3
  Tags: thumbnails, image, featured image
4
  Requires at least: 2.9.2
5
  Tested up to: 4.0
6
+ Stable tag: 1.6.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9