Image Widget
[resolved] Responsive Sites (5 posts)

  1. artifaktCom
    Posted 3 years ago #

    Hey there,

    Just wondering what's the best practice to do for responsive sites? The images on ours do not appear to be responding to screen size at all.



  2. mw360
    Posted 3 years ago #

    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;";


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

    ...and change line 288 from:

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


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

  3. Peter Chester
    Modern Tribe
    Plugin Author

    Posted 3 years ago #

    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:


  4. artifaktCom
    Posted 3 years ago #

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

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

  5. mw360
    Posted 3 years ago #

    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.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Image Widget
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.