How do I test whether [gallery] is empty?
You can check if an attachment for the given post exists with the get_posts function. This will create a new sql query – so there could be a performance issue. // Util.class.php class Util { public static function has_attachments() { $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ => null, ‘post_parent’ => $post->ID … Read more