Really Simple Gallery Widget 1.1

After several months of a severe reduction in the amount of “free” time I have, I finally managed to sit down and finish an update to the Really Simple Gallery Widget plugin. This update adds the ability to choose to use images from the entire media library and/or view only the images attached to the post/page being viewed. It also has some cleaner and safer HTML and should have a better memory footprint (not that it was a hog to begin with). Available in the WordPress plugin repository now.

* Download Really Simple Gallery Widget 1.1 *

Really Simple Gallery Widget 1.1

Styling the Really Simple Gallery Widget

The Really Simple Gallery Widget has some very light CSS selectors in the HTML for you to apply your styles to. They amount to this: there is an outer div with the class “rsgallery”, each image is given a class of “rsg_image”, and captions are given a class of “rsg_caption”. There are no current plans attach stylesheets, but some better structure and/or options for classes may be provided in a future version.


/* Add some space (20 pixels in this example) under each image */
.rsg_image { margin-bottom:20px; }
/* Add a border that changes when moused over
Important: don't forget that you need to add double the width of the border to the image width to get the total */
a .rsg_image { border:1px solid #00F; }
a:hover .rsg_image { border: 1px solid #F00; }
/* Create a grid of images - will not work with captions in the current version. Adjust the margins to fit in the width of the widget area - there will be leftover margin on some sides
Be careful - the floating may cause your layout to behave strangely, especially anything that follows the gallery widget */
.rsg_image { float:left; margin:0 20px 20px 0; }

To add CSS to a theme that you can’t edit, try using the the Simpler CSS plugin. Remember that if you edit a CSS file in a downloaded theme like Twenty Ten, it will probably get overwritten if you upgrade the theme in the future. Make a child theme instead.

Styling the Really Simple Gallery Widget

Really Simple Gallery Widget

Yes, it’s yet another plugin born out of a specific work request that seems usable by the general public. We’ve got some pages that function as photo galleries and we like to show said photos in the sidebar in a random order with a link to an anchor on the gallery page or showing the full-size image in a Shadowbox overlay. Turns out that the built-in gallery shortcode doesn’t actually do random (as far as I could tell) and shows captions by default and all kinds of things that just weren’t working for me (or the people I report to). I looked through and tried out a pretty ridiculous number of plugins, many of which required the use of separate galleries or new posts of a custom post type, and none of which did what I needed them to do – just use the built-in attachment functionality.

So, I wrote a widget and then made it into a plugin that does more than what I originally needed. A couple examples:

Available shortly now in the WordPress plugin repository: Here’s all the stuff from the readme file:

Really Simple Gallery Widget

Donate link:
Tags: gallery, widget
Requires at least: 2.8
Tested up to: 3.1

Simple widget for displaying images attached to a specific post or page.


Really Simple Gallery Widget adds a widget to display images that are attached to a post or page, no extra uploading or creating custom post types required. Especially helpful if you create photo gallery pages using the built-in WordPress gallery and just want to be able to display those images in a widget area.


  • Add as many widgets as you want, wherever you want
  • Select a number of images
  • Select any registered size in WordPress
  • Display the images in ascending, descending, or random order
  • Show or hide captions
  • Link the images to the original file, post, anchor in the post, attachment page, or nothing
  • Add a prefix to the link and image title (appears as a tooltip)
  • Use a rel attribute for the link – great for lightboxes


Really Simple Gallery Widget is most easily installed automatically via the Plugins tab in your blog administration panel. Go to Appearance -> Widgets to set one or more widgets up.

Manual Installation

  1. Upload the really-simple-gallery-widget folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Head over to Appearance -> Widgets to set up one or more Really Simple Gallery Widgets

Frequently Asked Questions

How do I get the ID for the post or page?
The easiest way is to mouseover or click an edit link for the post or page in question. The ID number will appear in the URL; e.g. indicates that the ID of the post or page you want to reference is 41.

Why is the anchor link not working?
The anchor link relies on the ID that WordPress automatically generates when you insert an image with a caption. If you inserted the image manually or without a caption, the anchor won’t jump you to the spot in the page. The ability to specify an anchor may be added at a later time, or you can just add the ID (attachment_##) to the img tag.

I selected a registered size but the images are showing up huge or in the wrong size.
The images may be missing the thumbnails of that size and by default will pull the full size image instead. Try using Viper007Bond’s fantastic Regenerate Thumbnails plugin to create new versions for any new or changed image sizes.


Really Simple Gallery Widget options
Widget options
Sample display with prefixed title showing
Sample display with prefixed title showing



  • First version
Really Simple Gallery Widget