src/Pure_CSS_Gallery.php
public function _post_gallery( $output, $attr, $instance ) {
		$post = get_post();

		if ( ! empty( $attr['ids'] ) ) {
			if ( empty( $attr['orderby'] ) ) {
				$attr['orderby'] = 'post__in';
			}
			$attr['include'] = $attr['ids'];
		}

		$atts = shortcode_atts( [
			'id'      => $post ? $post->ID : 0,
			'link'    => '',
			'size'    => 'thumbnail',
			'columns' => 3,
			'order'   => 'ASC',
			'orderby' => 'menu_order ID',
			'include' => '',
		], $attr );

		$pot_id = intval( $atts['id'] );

		if ( ! empty( $atts['include'] ) ) {
			$attachments = get_posts( array(
				'include'        => $atts['include'],
				'post_status'    => 'inherit',
				'post_type'      => 'attachment',
				'post_mime_type' => 'image',
				'order'          => $atts['order'],
				'orderby'        => $atts['orderby'],
			) );
		} else {
			$attachments = get_children( array(
				'post_parent'    => $pot_id,
				'post_status'    => 'inherit',
				'post_type'      => 'attachment',
				'post_mime_type' => 'image',
				'order'          => $atts['order'],
				'orderby'        => $atts['orderby'],
			) );
		}

		if ( empty( $attachments ) ) {
			return '';
		}

		if ( is_feed() ) {
			return $this->_render( 'feed', array(
				'attachments' => $attachments,
			) );
		}

		return $this->_render( 'pure-css-gallery', array(
			'attachments' => array_values( $attachments ),
			'atts'        => $atts,
		) );
	}
public function _post_gallery( $output, $attr, $instance ) {
		$post = get_post();

		if ( ! empty( $attr['ids'] ) ) {
			if ( empty( $attr['orderby'] ) ) {
				$attr['orderby'] = 'post__in';
			}
			$attr['include'] = $attr['ids'];
		}

		$atts = shortcode_atts( [
			'id'      => $post ? $post->ID : 0,
			'link'    => '',
			'size'    => 'thumbnail',
			'columns' => 3,
			'order'   => 'ASC',
			'orderby' => 'menu_order ID',
			'include' => '',
		], $attr );

		$pot_id = intval( $atts['id'] );

		if ( ! empty( $atts['include'] ) ) {
			$attachments = get_posts( array(
				'include'        => $atts['include'],
				'post_status'    => 'inherit',
				'post_type'      => 'attachment',
				'post_mime_type' => 'image',
				'order'          => $atts['order'],
				'orderby'        => $atts['orderby'],
			) );
		} else {
			$attachments = get_children( array(
				'post_parent'    => $pot_id,
				'post_status'    => 'inherit',
				'post_type'      => 'attachment',
				'post_mime_type' => 'image',
				'order'          => $atts['order'],
				'orderby'        => $atts['orderby'],
			) );
		}

		if ( empty( $attachments ) ) {
			return '';
		}

		if ( is_feed() ) {
			return $this->_render( 'feed', array(
				'attachments' => $attachments,
			) );
		}

		return $this->_render( 'pure-css-gallery', array(
			'attachments' => array_values( $attachments ),
			'atts'        => $atts,
		) );
	}
public function _post_gallery ( $ output , $ attr , $ instance ) { $ post = get_post ( ) ; if ( ! empty ( $ attr [ 'ids' ] ) ) { if ( empty ( $ attr [ 'orderby' ] ) ) { $ attr [ 'orderby' ] = 'post__in' ; } $ attr [ 'include' ] = $ attr [ 'ids' ] ; } $ atts = shortcode_atts ( [ 'id' => $ post ? $ post -> ID : 0 , 'link' => '' , 'size' => 'thumbnail' , 'columns' => 3 , 'order' => 'ASC' , 'orderby' => 'menu_order ID' , 'include' => '' , ] , $ attr ) ; $ pot_id = intval ( $ atts [ 'id' ] ) ; if ( ! empty ( $ atts [ 'include' ] ) ) { $ attachments = get_posts ( array ( 'include' => $ atts [ 'include' ] , 'post_status' => 'inherit' , 'post_type' => 'attachment' , 'post_mime_type' => 'image' , 'order' => $ atts [ 'order' ] , 'orderby' => $ atts [ 'orderby' ] , ) ) ; } else { $ attachments = get_children ( array ( 'post_parent' => $ pot_id , 'post_status' => 'inherit' , 'post_type' => 'attachment' , 'post_mime_type' => 'image' , 'order' => $ atts [ 'order' ] , 'orderby' => $ atts [ 'orderby' ] , ) ) ; } if ( empty ( $ attachments ) ) { return '' ; } if ( is_feed ( ) ) { return $ this -> _render ( 'feed' , array ( 'attachments' => $ attachments , ) ) ; } return $ this -> _render ( 'pure-css-gallery' , array ( 'attachments' => array_values ( $ attachments ) , 'atts' => $ atts , ) ) ; }
Filters the default gallery shortcode output

@param string $output The gallery output. Default empty.
@param array $attr Attributes of the gallery shortcode.
@var link string null|file|none
@var size string null|thumbnail|medium|large|full
@var columns int
@var ids string
@var orderby string rand|null
@param int $instance Unique numeric ID of this gallery shortcode instance.
Filters the default gallery shortcode output