'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'div', 'icontag' => 'div', 'captiontag' => 'div', 'columns' => 3, 'size' => 'thumbnail', 'exclude' => '' ), $attr ) ); // Initialize $id = intval( $id ); $attachments = array(); if ( $order == 'RAND' ) $orderby = 'none'; if ( ! empty( $include ) ) { // Include attribute is present $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 ) ); // Setup attachments array foreach ( $_attachments as $key => $val ) { $attachments[ $val->ID ] = $_attachments[ $key ]; } } else if ( ! empty( $exclude ) ) { // Exclude attribute is present $exclude = preg_replace( '/[^0-9,]+/', '', $exclude ); // Setup attachments array $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } else { // Setup attachments array $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } if ( empty( $attachments ) ) return ''; // Filter gallery differently for feeds if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $att_id => $attachment ) $output .= wp_get_attachment_link( $att_id, $size, true ) . "\n"; return $output; } // Filter tags and attributes $itemtag = tag_escape( $itemtag ); $captiontag = tag_escape( $captiontag ); $columns = intval( $columns ); $itemwidth = $columns > 0 ? floor( 12 / $columns ) : 100; $float = is_rtl() ? 'right' : 'left'; $selector = "gallery-{$instance}"; // Filter gallery CSS $output = apply_filters( 'gallery_style', "