WordPress.org

Support

Support » Plugins and Hacks » Image Widget » [Resolved] Responsive Sites

[Resolved] Responsive Sites

Viewing 4 replies - 1 through 4 (of 4 total)
  • I NEVER Recommend changing core code unless you feel comfortable in documenting/maintaining it through an upgrade – and I’m sure there is a simple function that can achieve this just don’t have the time to figure it out… but if you want a down and dirty temporary fix to get by for the moment this seems to work (v4.01)…

    in /plugins/image-widget-image-widget.php…

    Change line 285 from:

    $attr['style'] .= "max-width: {$instance['width']}px;";

    To…

    $attr['style'] .= "max-width: 100%;";

    …and change line 288 from:

    $attr['style'] .= "max-height: {$instance['height']}px;";

    To…

    $attr['style'] .= "height: auto;";

    Plugin Author Peter Chester

    @peterchester

    I don’t recommend changing code in the plugin as it will make it so you can never upgrade the plugin.

    I think it’s an excellent idea to add responsive support to this plugin but for the interim, the way to solve this is to write your own view for the widget using the ‘sp_template_image-widget_widget’ filter.

    See the “Default vs. Custom Templates’ section here:

    http://wordpress.org/extend/plugins/image-widget/other_notes/

    Cool. Thanks Peter! I’ll give that a shot.

    Hope to see an update to make the plugin responsive in the future!

    Hey Peter,

    Thanks for the update.

    As stated I completely agree regarding code changes – but sometimes folks are faced with the need to get things going temporarily while trying to work out the proper solution, as was the case for me.

    I will review the document you pointed to for future reference, thanks for that – but also, wanted to mention there is another (PROPER) way users can make this plugin responsive as it stands today – by adding a variation of the following to the theme’s custom CSS (it should work as shown for most):

    .widget_sp_image img {height:auto !important;max-width:100% !important;}

    For those who don’t want to mess with filters this is certainly a more suitable alternative vs. the temp code mod.

    Cheers

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Responsive Sites’ is closed to new replies.
Skip to toolbar