I want to setup a gallery without including it in the content to be able to access it in the theme files.
Currently I use a dummy page that only contains the gallery and isn’t reachable from the front end. I would prefer to skip this step and keep the gallery setup on the page where it is displayed.
If the gallery has to be include in the content could I modify the handling of the shortcode in a template specific way and include the gallery before calling the_content();
?
I’ve used this to display the gallery under the content in a few of my website, or in a custom position, you can manipulate it however you need. The only draw back (sort of) is if there are 2 galleries, it will only work with the first gallery.
Functions.php