Plugin Author
DeBAAT
(@debaat)
Hai.
Looks like there is a misunderstanding between the terms category and gallery.
A gallery is a way to group media files together and use that as some sort of shorthand for that group.
A category is a different way to group media files by assigning a category to each media file.
From the description above, it looks to me that you are using galleries by assigning categories.
The situation you would want can be created using the shortcode parameter “alternative_shortcode“. It works as follows:
Suppose you want to have a gallery with ids=”20,18,19″. Then you should create a MCM category, e.g. “canada” and assign these three media to that category.
Then the post with the following shortcode for galleries:
[gallery ids="20,18,19"]
should have the same result as the following using the category:
[wp-mcm alternative_shortcode="gallery" category="canada"]
Hope this helps.
Thread Starter
Martin
(@maltham)
Thanks DeBAAT.
I tried [gallery ids="20,18,19"] and found the problem still existed: after clicking on one of the images and then next/previous I would eventually get images from outside the gallery.
I couldn’t get any output from [wp-mcm alternative_shortcode=”gallery” category=”canada”] but on the assumption it would replicate the same problem I did the following in my child theme functions.php
1) add_filters to intercept the following:
add_filter(‘next_image_link’, ‘my_next_image_link’, 1, 2);
add_filter(‘previous_image_link’, ‘my_previous_image_link’, 1, 2);
2) add functions my_next_image_link (and previous) to allow a custom function my_adjacent_image_link which replaces the one in media.php
eg
function my_previous_image_link($size = ‘thumbnail’, $text = false) {
my_adjacent_image_link(true, $size, $text);
3) In this new function I check the category of adjacent images and if not the same as the original image then skip along the image array until a match is found.
Not really a problem of WP-MCM but it allows me to keep your fantastic image categorisation system.
Thanks again