function cfcp_gallery($args = array()) { $defaults = array('number' => -1, 'id' => get_the_ID(), 'attachment_ids' => null, 'before' => '', 'after' => ''); $args = array_merge($defaults, $args); $gallery = new CFCT_Gallery($args['id'], $args['number'], $args['attachment_ids']); if ($gallery->exists()) { echo $args['before']; $gallery->render($args); echo $args['after']; } unset($gallery); }