WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Simple Image Widget

A simple widget that makes it a breeze to add images to your sidebars.

Is there a way to filter the widget output?

Absolutely. Changing the output can be done a few different ways, but the most common alternatives involve using the "simple_image_widget_output" filter or overriding the template in your theme.

To use the template method, copy "widget.php" from the "/templates" directory in the plugin to a "/simple-image-widget" directory in your theme. Then update as you wish. It's also possible to create a custom template specific to each sidebar in your theme using the following default template hierarchy:

  • {theme}/simple-image-widget/{sidebar_id}_widget.php
  • {theme}/simple-image-widget/widget.php
  • {plugin}/templates/widget.php

Always use a child theme to make changes if you acquired your theme from a third-party and you expect it to be updated. Otherwise, you run the risk of losing your customizations.

How do I add alt text to images in the widget?

When selecting an image in the media modal (the popup to select images), the right sidebar will be titled "Attachment Details" and contains a field for entering alt text. After entering your alt text, click the "Update Image" button to use the selected image in your widget. Most browsers don't show the alt text, so you'll need to view the HTML source to make sure it exists.

How do I center the widget?

The widget can be centered using CSS. Custom CSS should be added a child theme or using a plugin like Simple Custom CSS or Jetpack. The following snippet will center the contents of the widget:

.widget_simpleimage {
     text-align: center;
}

Can I remove the width and height attributes?

The widget uses the core function wp_get_attachment_image() to display the image and it would be more trouble than it's worth to remove those attributes. Some basic CSS will typically allow you to make the image responsive if necessary:

.widget_simpleimage img {
    height: auto;
    max-width: 100%;
}

Requires: 3.5 or higher
Compatible up to: 4.0
Last Updated: 2014-7-25
Downloads: 234,654

Ratings

4 stars
4.5 out of 5 stars

Support

1 of 2 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

1 person says it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1
100,1,1
100,3,3
100,3,3
100,2,2
100,1,1
100,1,1
50,2,1
100,1,1
100,4,4
100,1,1
100,2,2
100,1,1
100,1,1
100,2,2
0,1,0
100,1,1
0,1,0 100,1,1
100,1,1