widget dropdown menu code

I’m trying to put in a simple dropdown menu in my widget. I copied one out of a previous widget and trying to substitute my own values into it. The submenu shows, but when I click save, it saves only the first selection (design 1). Actually, I echoed the value on the widget and all of the options displayed.

What would a simple widget drop down menu look like?
As for my code, I think I need to get that “true” out of there and replace it with Design#

<label for="<?php echo $this->get_field_id('fold_design'); ?>"><?php _e('Display style:'); ?></label> 
        <select id="<?php echo $this->get_field_id('fold_design'); ?>" name="<?php echo $this->get_field_name('fold_design'); ?>" class="widefat" />
            <option <?php selected( 'Design1', $instance['fold_design'], true ); ?>>Design 1</option>
            <option <?php selected( 'Design2', $instance['fold_design'], true ); ?>>Design 2</option>
            <option <?php selected( 'Design3', $instance['fold_design'], true ); ?>>Design 3</option>
            <option <?php selected( 'Design4', $instance['fold_design'], true ); ?>>Design 4</option>
            <option <?php selected( 'Design5', $instance['fold_design'], true ); ?>>Design 5</option>
            <option <?php selected( 'Design6', $instance['fold_design'], true ); ?>>Design 6</option>
            <option <?php selected( 'Design7', $instance['fold_design'], true ); ?>>Design 7</option>
        </select>

Related posts

Leave a Reply

1 comment