Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Untitled Snippet

// WP_Query arguments
$args = array(
	'p'                      => 'id',
	'name'                   => 'Name',
	'page_id'                => 'Display page by ID',
	'pagename'               => 'gallery',
	'post_type'              => array( 'gallery' ),
	'nopaging'               => false,
	'posts_per_page'         => '6',
	'ignore_sticky_posts'    => true,
	'order'                  => 'ASC',
	'orderby'                => 'id',
);

// The Query
$query = new WP_Query( $args );

// The Loop
if ( $query->have_posts() ) {
	while ( $query->have_posts() ) {
		$query->the_post();
		// do something
	}
} else {
	// no posts found
}

// Restore original Post Data
wp_reset_postdata();