Support » Plugin: Image Widget » [Plugin: Image Widget] Request: Widget Title and Width

  • Sarah


    Hey there! This is a great plugin. So close to what I’m looking for.

    I am using this as a “Currently Reading” widget on my book blog where I can pick the book cover from my media library and then link to goodreads.

    So my problem with this widget is that every time I change the image it changes the widget title. I would like it to stay the same (“Currently Reading”) no matter what image I put in. Also, I like to keep the width consistent (height doesn’t matter) so it fits nicely in my sidebar. So it’d be nice for that to stay the same too.

    Even if these were just settings in the admin, that’d be cool, but I thought I’d put those ideas out there! 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • section13


    This feature would be very helpful for me as well. My client frequently changes out the image in the widget, but needs the title to remain the same.

    Yeah, this is sort of critical – Clients shouldn’t have to mess with this … Seems really sloppy.



    I think you can get the result you want easily enough:

    Hard Coded Title

    1. Create a new folder called “image-widget” in your template directory and copy over the “views/widget-admin.php” and “views/widget.php” files from the plugin directory. If these files exist, the plugin will use these files instead of the ones in it’s own folder. More details here
    2. ‘widget-admin.php’ contains the admin area interface of the plugin. Open it and comment out the section that asks the user for the title. Then just add a new hidden element that contains a hard-coded title e.g.
      <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="hidden" value="Currently Reading" />

    Note that this will hard-code the title for all instances of the widget.

    Fixed Width Image
    In your theme’s CSS add a rule that forces the width to be whatever you need for your theme.

    /* .widget_sp_image is applied to all instances of the Image Widget */
    .widget_sp_image img {
      max-width: 300px !important; /* Overrides plugin default width, Images can still be narrower than 300px */
      /* OR */
      width: 300px !important; /* Forces width, narrower images will be stretched */

    Just put 100% in the width


    Can someone with better knowledge of me hepl me out with adding option for custom width of the widget?

    Thanks in advance

    Plugin Author Peter Chester


    Modern Tribe

    Great work @eoinkelly!!!

    Dude! @scott Hendison, it’s not sloppy, it’s intentional. I’m open to suggestions but I work hard for free on this stuff and take offense to having my work called ‘sloppy’.

    FYI, we just deployed a new version (3.3.7) with filters for width / height. That means that you can easily override them in your theme.


    in theory you could use these filters to override whatever width or height is specified.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Image Widget] Request: Widget Title and Width’ is closed to new replies.