How to provide support for [gallery] shortcode?
-
16-10-2019 - |
Question
I'm developing a new custom theme - and noticed that if a post contains the shortcode [gallery] it gets ignored (edit: I mean that the HTML delivered to the browser does not include [gallery], nor anything in its place... I think there's a blank line or two)
My Theme is
- grabbing post contents via
the_content('→')
; - also removing the standard
<p></p>
wrapper viaremove_filter('the_content', 'wpautop');
The Codex does not list this as one of the features you explicitly have to add support for - but we know the codex can be outdated/incomplete at times.
Anyways, what is it needed for a theme to recognize [gallery] (and/or other such standard shortcodes) ?
Solution
Have you added any images to the page in which you are using the gallery?
The [gallery] shortcode won't work without there actually being attachments on said post.
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange