I’m using galleries for attaching images, so the very first gallery for every post is used to generate a slider and nothing more. That’s why I don’t want to see it in post’s conent. Let’s say I have a single post that looks like this:
// hide
// display
// display
Is there some way of blocking the very first gallery from the content for every post?
#gallery-1 { display: none !important; }
works good but is ugly as hell 🙂 Also it only hides the gallery but it’s still there, same goes for it’s JS.
You could use
preg_replace()
but I think it’s much easier to overwrite the$output
via thepost_gallery
filter and then remove the filter after the first run:This should remove only the first gallery in your posts.