A simple widget that makes it a breeze to add images to your sidebars.
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.
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.
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;
}
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: 4.4 or higher
Compatible up to: 4.6.4
Last Updated: 6 months ago
Active Installs:
80,000+
Got something to say? Need help?