Detecting if parent page has gallery

It happens because strpos returns 0 (zero index position) when gallery shortcode is at the start of the content which is treated as false by the if condition.

Solution is to use Identical operator === in condition to check if the return value is a boolean false.

tech