You appear to be a bot. Output may be restricted
Description
Usage
WPCOM_JSON_API_Post_Endpoint::win8_gallery_shortcode( $attr );
Parameters
- $attr
- ( mixed ) required –
Returns
void
Source
File name: jetpack/json-endpoints/class.wpcom-json-api-post-endpoint.php
Lines:
1 to 61 of 61
function win8_gallery_shortcode( $attr ) { global $post; static $instance = 0; $instance++; $output = ''; // We're trusting author input, so let's at least make sure it looks like a valid orderby statement if ( isset( $attr['orderby'] ) ) { $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] ); if ( !$attr['orderby'] ) unset( $attr['orderby'] ); } extract( shortcode_atts( array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'include' => '', 'exclude' => '', 'slideshow' => false ), $attr, 'gallery' ) ); // Custom image size and always use it add_image_size( 'win8app-column', 480 ); $size = 'win8app-column'; $id = (int) $id; if ( 'RAND' === $order ) $orderby = 'none'; if ( !empty( $include ) ) { $include = preg_replace( '/[^0-9,]+/', '', $include ); $_attachments = get_posts( array( 'include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[$val->ID] = $_attachments[$key]; } } elseif ( !empty( $exclude ) ) { $exclude = preg_replace( '/[^0-9,]+/', '', $exclude ); $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } else { $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } if ( ! empty( $attachments ) ) { foreach ( $attachments as $id => $attachment ) { $link = isset( $attr['link'] ) && 'file' === $attr['link'] ? wp_get_attachment_link( $id, $size, false, false ) : wp_get_attachment_link( $id, $size, true, false ); if ( $captiontag && trim($attachment->post_excerpt) ) { $output .= "<div class='wp-caption aligncenter'>$link <p class='wp-caption-text'>" . wptexturize($attachment->post_excerpt) . "</p> </div>"; } else { $output .= $link . ' '; } } } }