function cfpf_gallery_output($args = array()) { // setup args if we have any $args_string = ''; if (!empty($args)) { foreach ($args as $k => $v) { $args_string .= $k . '="' . esc_attr($v) . '" '; } } $type = cfpf_post_gallery_type(); // if type is set to shortcode, make sure we have something as a shortcode if ($type == 'shortcode') { $post = get_post(); $shortcode = trim(get_post_meta($post->ID, '_format_gallery_shortcode', true)); if (!empty($shortcode) && substr($shortcode, -1) == ']') { // add args $shortcode = substr($shortcode, 0, -1) . ' ' . $args_string . ']'; echo do_shortcode($shortcode); return; } } // or fall back to attached images echo do_shortcode('[gallery ' . $args_string . ']'); }
<?php $gallery_type = cfpf_post_gallery_type(); ?> <div id="cfpf-format-gallery-preview" class="cf-elm-block cf-elm-block-image" style="display: none;"> <label><span><?php _e('Gallery Images', 'cf-post-format'); ?> </span></label> <div class="cf-elm-container cfpf-gallery-options"> <p> <input type="radio" name="_format_gallery_type" value="shortcode" <?php checked($gallery_type, 'shortcode'); ?> id="cfpf-format-gallery-type-shortcode" /> <label for="cfpf-format-gallery-type-shortcode"><?php _e('Shortcode', 'cf-post-format'); ?> </label> <input type="text" name="_format_gallery_shortcode" value="<?php echo esc_attr(get_post_meta($post->ID, '_format_gallery_shortcode', true)); ?> " id="cfpf-format-gallery-shortcode" /> </p> <p> <input type="radio" name="_format_gallery_type" value="attached-images" <?php checked($gallery_type, 'attached-images'); ?> id="cfpf-format-gallery-type-attached" />
?> " rel="bookmark"><?php the_title(); ?> </a></h1> <time class="entry-date" datetime="<?php the_time('c'); ?> " pubdate><a href="<?php the_permalink(); ?> "><?php echo cfcp_date(); ?> </a></time> </div> <div class="entry-content"> <?php $args = array('size' => 'thumb-img', 'before' => '<div class="entry-media clearfix">', 'after' => '</div>'); if (cfpf_post_gallery_type() == 'shortcode') { $args['attachment_ids'] = cfpf_post_gallery_shortcode_ids(); } cfcp_gallery_excerpt($args); the_excerpt(); ?> </div> <?php cfct_misc('entry-meta-excerpts'); ?> </article>