Garee’s Split Gallery

On my blog I use a lot of images. Sometimes I’d like to write a few sentences, show a couple of pictures, then write some more.

Wordpress uses the gallery-shortcode to insert images, but either you show all the images attached to the post, or you have to pick them by entering their IDs, which is really a pain. Inserting pictures one by one isn’t really an option neither, since WordPress inserts hardcoded links directly in your blog-post-text — whenever you change something in the media-library those changes won’t be reflected in your post!

So I wrote a small plugin, that enables you to use the native WordPress-gallery in a more efficient way, by allowing you to split the gallery into smaller parts.

Main-advantages:

  • easily split your galleries
  • show only images of a certain filetype
  • set default-values in settings
  • uses native WordPress-gallery (no additional code)

Version 0.5 | Download from WordPress

Usage

To show just the first 3 pictures of your gallery just insert:

[split_gallery show='1-3']

The show-attribute allows more complex notation:

[split_gallery show='3,4-6,8-10,12,14-16']

There’s even another way to filter the pictures shown in your gallery — by filetype:

[split_gallery filetype='jpg']

With the exception of ‘include’ and ‘exclude’ all other attributes of the original WordPress-gallery-shortcode are preserved.

[split_gallery id="2144" show="4-6" order="DESC" orderby="ID" size="medium" icontag="span" link="file"]

Settings

The plugin-settings-page allows default-values to be defined for the gallery-shorcode attributes. E.g. if you prefer your gallery-links to link to the image-file instead of its permalink, you can set default value for link=”file” and all split_gallery-shortcodes will behave just like you had set each’s option link=”file”.

How it works

The final output is generated by the originial WordPress-gallery — my plugin just translates ‘show’ and ‘filetype’ into a list of IDs for the gallery-shortcode to use. So if you enter the following shortcode

[split_gallery show='1-3' orderby='title']

my plugin gets the IDs of the first 3 images attached to the current post or page. Lets assume there’s a default-setting for link=”file”. Then my plugin inserts this attribute as well and finally calls:

[gallery include='234,213,239' orderby='title' link='file']

where 234, 213 and 239 are the IDs of the first 3 pictures of the gallery.

10 Responses to “Garee’s Split Gallery”


  • Sorry could not edit my question. It looks like I cannot use the filetype and the show parameters at the same time. Is that correct?

    • I just ran a test and I can put set parameters at the same time. But the counter for the show-option will skip all other filetypes. So if you've got a single gif at position 3 and lots of jpegs in your gallery and set filetype"jpg" and show="3" it will show the jpg after the gif (at position 4 of your gallery)

  • Hi there,

    I was wondering if you can use [split_gallery filetype='jpg'] with more than one filetype. Like
    [split_gallery filetype='jpg gif jpeg']? If not would it be easy to implement?

    • Hi Sascha
      Right now it's not possible to have multiple filetypes. I think I'll can add this feature in the next version, it won't be too hard to do…

    • Besides jpg and jpeg are the same for my plugin. It doesn't actually search for filetypes in the names of files, but for mime-types in the wordpress-database.

  • Hi Sebastian,
    also ich hoffe ihr hattet eine tolle Zeit in Californien!!!

    Also das plugin funktioniert super! Soweit ich es erkennen kann funktioniert es auch mit dem Cleaner Gallery plugin in Verbindung. Tolle Arbeit,
    Sascha

  • Hey Garee,

    just what I was looking for too!!! Thank you for making this plugin, it's sooo needed! One question I have:

    Does it work together with the "Cleaner Gallery" plugin? As far as I know the cleaner gallery plugin only changes the html output….

    Anyway, I will give this a try tomorrow.
    Will flatr you (and many other WP wizards) as soon as I have some spare $$$ and the site is live.

    • Hi Sascha
      Great you found out yourself that it works with plugins like "Cleaner Gallery". Garee's Split Gallery actually just gathers the images that should be shown and the calls the wordpress-gallery-shortcode to show just these images. Hence every other plugin that manipulates the output of the wordpress-gallery-shortcode will work in combination with my plugin.

  • Thanks for this plugin, i’ll give it a try. I’t exactly what i’ve looking for

Leave a Reply

*

If you like Garee's Split Gallery plugin, you can buy me a coffee!

Flattr this
or