raphaello77
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [Simple Image Widget] add new fieldHmm I did try that filter but something didnt want to work cant remember exactly what at the moment.. Ill try it again ??
What i am trying to do is to add your great image upload feature (that i really like!!) and combine it with a woocommerce product listing widget and a custom taxonomy selector..
I added a whole lot of file extra fields there..
PS: Thanks for a really great plugin Brady!
Forum: Plugins
In reply to: [Simple Image Widget] add new fieldI did it like this:
first overloaded this class function and added my field extra_field
public function form_fields() { return array( 'image_size', 'link', 'link_text', 'link_classes', 'text', 'extra_field', ); }
then used this filter
add_filter( 'simple_image_widget_instance', function( $instance, $new_instance, $old_instance, $id_base ) { $instance['show'] = absint( $new_instance['extra_field'] ); return $instance; }, 10, 4 );
then added the input field with this action
add_action( 'simple_image_widget_field-extra_field', function( $instance, $that ) { ?> <p> <label for="<?php echo esc_attr( $that->get_field_id( 'extra_field' ) ); ?>">Extra field</label> <input class="widefat" id="<?php echo esc_attr( $that->get_field_id( 'extra_field' ) ); ?>" name="<?php echo esc_attr( $that->get_field_name( 'extra_field' ) ); ?>" type="number" step="1" min="1" max="" value="<?php echo $instance['extra_field'] ?>"> </p> <?php }, 10, 2);
Workes good and seemed correct atleast..
Viewing 2 replies - 1 through 2 (of 2 total)