• Resolved markcallen

    (@markcallen)


    Hi all

    I have a widget that shows the featured image of the post. One of the options is to let the user pick the size of the thumbnail to appear. I’m using this,

    <p><label for="<?php echo $this->get_field_id('size'); ?>"><?php _e('Image Size:'); ?></label><select class="widefat" id="<?php echo $this->get_field_id('size'); ?>" name="<?php echo $this->get_field_name('size'); ?>" />
        <?php $image_sizes=get_intermediate_image_sizes();
    			foreach($image_sizes as $image_size) {
    				echo '<option value="'.$image_size.'"';
    					if($image_size==$size) echo ' selected="selected"';
    				echo '>'.ucfirst($image_size).'</option>';
    			} ?>
    		</select></p>

    as part of the form function in the class. It works great except that once the save button is pressed, the select has no options.

    The result is saved as if I return to the widget page it shows correctly.

    The must be some issue with the results returned from get_intermediate_image_sizes(), but for the life of me I don’t know what that is.

    Any help appreciated!

Viewing 1 replies (of 1 total)
  • Thread Starter markcallen

    (@markcallen)

    This is resolved, by fixing a typo.
    I had self-closed the opening select element. (replaced /> with >)

Viewing 1 replies (of 1 total)
  • The topic ‘Drop-down widget problem on save’ is closed to new replies.