Simple Image Widget – WordPress plugin Free download

Click to Download

Simple Image Widget

Description

Simple Image Widget is what the name implies — the easiest way to add images to your sidebars. Display advertisements, calls-to-action, or even build a slider based on image widgets.

Despite its simplicity, Simple Image Widget is built with extensibility in mind, making it super easy to spin off new image-based widgets, or customize the widget ouput using the available template hierarchy.

Additional Resources

Write a review
Contribute on GitHub
Follow @cedaroco
Visit Cedaro

Screenshots

A new image widget.
The widget after selecting an image.

Installation

Install just like most other plugins. Check out the codex if you have any questions.

FAQ

Installation Instructions

Install just like most other plugins. Check out the codex if you have any questions.

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%;
}

Reviews

Leave a Reply

Your email address will not be published. Required fields are marked *