Check if post has a gallery
A simple check if the current post\page has a gallery shortcode within the post_content. Show different output for each case in your template with this snippet.
/** * Snippet Name: Check if post has a gallery * Snippet URL: https://wpcustoms.net/snippets/check-post-gallery/ */ if (strpos($post->post_content,'[gallery') === false){ $gallery = 0; // false - no gallery found } else { $gallery = 1; // true - this post\page has a gallery }