Multiple Post Thumbnails
show the correct size on post editing area (3 posts)

  1. Amit
    Posted 5 years ago #

    the metabox defaults to the value that was set through set_post_thumbnail_size, it'd be great if you could pass in the constructor either size or name and use that size where the new interface exists, i.e.:

    set_post_thumbnail_size( 298, 167, true ); //the default size used in the thumbnail interface
    add_image_size( 'athlete_thumb', 138, 174, true ); //the size i want in the new interface
    new MultiPostThumbnails( array(
        	'label' => 'Athlete Thumbnail Image',
        	'id' => 'id_athlete_thumb',
        	'post_type' => 'athlete',
            'size' => 'athlete_thumb' //new addition

    besides its great! thanks for the effort!

  2. Amit
    Posted 5 years ago #

    I managed it in a workaround for now:

    class changes:

    starting at line 54

    public function register($args = array()) {
    			$defaults = array(
    				'label' => null,
    				'id' => null,
    				'post_type' => 'post',
    				'priority' => 'low',
    				'new_width' => null,        //<=ADDED THAT
    				'new_height' => null        //<=ADDED THAT
    			$args = wp_parse_args($args, $defaults);

    then at line 241 (last array arguments changed)

    $thumbnail_html = wp_get_attachment_image($thumbnail_id, array($this->new_width, $this->new_height));

    and the just instantiate it like that:

    new MultiPostThumbnails( array(
        	'label' => 'Athlete Thumbnail Image',
        	'id' => 'id_athlete_thumb',
        	'post_type' => 'my_type',
    		'new_width' => 138,      //<=ADDED THAT
    		'new_height' => 174      //<=ADDED THAT
  3. Matt Brett
    Posted 5 years ago #

    Thanks for posting this mod/fix!

    Was a bit annoyed that a 300x300 image was in place of my 150x150 thumbnails.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Multiple Post Thumbnails
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic