Skip to content
Custom fields for WordPress that are quick to build and quick to load. Get Pro

Content on the page

A gallery grid

Print a gallery as a responsive grid.

1 minute Works with the free plugin

Fields. gallery (Gallery, return format Image ID).

PHP
<?php $images = ugly_get( 'gallery' ); ?>
<?php if ( $images ) : ?>
	<ul class="gallery">
		<?php foreach ( $images as $id ) : ?>
			<li>
				<a href="<?php echo esc_url( wp_get_attachment_image_url( $id, 'full' ) ); ?>">
					<?php echo wp_get_attachment_image( $id, 'medium' ); ?>
				</a>
			</li>
		<?php endforeach; ?>
	</ul>
<?php endif; ?>

The order is the one the editor dragged them into.