Hi @elliot
I used the code that you posted in your original reply exactly as you wrote it, with the exception that I changed
echo do_shortcode( $shortcode );
to
echo apply_filters('the_content', $shortcode);
It seems to be working fine, but some of this is a little over my head so I wanted to get your opinion. Do you think there’s any problems with using apply_filters instead of do_shortcode? Will this require more processing and potentially slow down the page?
I made this switch because I’m trying to use a plugin called Simple Light Box, and it won’t work if the gallery isn’t run though the the_content filter.
Thanks,
paul
Hi @elliot
The original code that Matthias and I both tried to use is at the bottom of the gallery field documentation, but I couldn’t find your revised code to use a gallery sub_field anywhere but on this thread. That’s the code I think it would be helpful to post in the documentation. Did I miss it?
Thanks,
paul
Elliot – thank you, thank you, thank you! I was trying to use the Gallery plugin with the Repeater plugin and I was having the same problem. I couldn’t figure out why the original WP Gallery code example wouldn’t work with get_sub_field.
It took me quite a while to find this thread. As a suggestion, you might consider putting this code example in either the Gallery or Repeater documentation (or both).
Thanks!