Gallery Widget: Support previous versions of WordPress

In a681bb2, we added support for WordPress 3.9 but apparently broke support
for previous versions. This commit should restore support for WP < 3.9.

See #437.