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

Content on the page

A responsive image with the right alt text

Print an image with its sizes and the alt text the editor wrote.

1 minute Works with the free plugin

PHP
<?php
$photo_id = ugly_get( 'photo' );

if ( $photo_id ) {
	echo wp_get_attachment_image(
		$photo_id,
		'large',
		false,
		array(
			'class'   => 'article__photo',
			'loading' => 'lazy',
			'sizes'   => '(min-width: 800px) 800px, 100vw',
		)
	);
}

The alt text comes from the media library, as always. Fill it in there.