Quantcast
Channel: responsive – WordPress.org Forums
Viewing all articles
Browse latest Browse all 16569

Opally on "[Plugin: Image Widget] Where to edit code to make image size responsive"

$
0
0

Easy enough to add a responsive select option, but not obvious to me yet where to set the $size values for it (100% width, and auto height.)

in widget-admin.php, under $possible_sizes = apply_filters

add near the bottom:

'responsive'=> __('Responsive', 'image_widget'),

But where to code in the values... hmm...

Here's what does NOT work:
in image-widget.php in private function get_image_size( $instance )

if (!empty( $instance['size'] ) && $instance['size'] == 'responsive' ) {
$instance['width'] = apply_filters( 'image_widget_image_width', abs( $instance['width'] ), '100%', $instance );
$instance['height'] = apply_filters( 'image_widget_image_height', abs( $instance['height'] ), 'auto', $instance );

but I don't see how to load these filter values into $size. Can't be that hard to set these filters?


Viewing all articles
Browse latest Browse all 16569

Trending Articles