The Gallery feature allows you to add one or more image galleries to your posts and pages. Up until WordPress 3.5, the gallery shortcode was commonly used in its most basic form:
[ gallary ]
Following 3.5, gallery shortcodes now include the image IDs by default.
Like this: [ gallary ids="5,153,543,464" ]
Below code will help you find to see if a post contains the gallery shortcode. Add this code to the single.php
template of your WordPress theme inside the loop.
if (strpos($post->post_content,'[gallery') === false){ echo 'Post/Page has no gallery'; }else{ echo 'Post/Page has gallery'; }