function cfcp_gallery_shortcode($content, $args = array()) { // Go with default gallery if in a feed (we don't want to run JS in feeds) if (is_feed()) { return ''; } $post = get_post(); $gallery_args = $defaults = array('number' => -1, 'id' => $post->ID, 'attachment_ids' => null, 'before' => '<div>', 'after' => '</div>'); // occasionally $args is null if (is_array($args)) { $gallery_args = array_merge($defaults, $args); } if (!empty($args['ids'])) { $gallery_args['attachment_ids'] = $args['ids']; } $gallery = new CFCT_Gallery($gallery_args['id'], $gallery_args['number'], $gallery_args['attachment_ids']); ob_start(); echo $args['before']; $gallery->render($args); echo $args['after']; return ob_get_clean(); }
function cfcp_gallery_shortcode($content, $args) { // Go with default gallery if in a feed (we don't want to run JS in feeds) if (is_feed()) { return ''; } global $content_width; $defaults = array('number' => -1, 'id' => get_the_ID(), 'attachment_ids' => null, 'before' => '<div>', 'after' => '</div>'); $gallery_args = array_merge($defaults, $args); if (!empty($args['ids'])) { $gallery_args['attachment_ids'] = $args['ids']; } $gallery = new CFCT_Gallery($gallery_args['id'], $gallery_args['number'], $gallery_args['attachment_ids']); ob_start(); echo $args['before']; $gallery->render($args); echo $args['after']; return ob_get_clean(); }