Created
May 18, 2017 13:27
-
-
Save druellan/4a6a5e1d0b445d9edbf38e695e1221cc to your computer and use it in GitHub Desktop.
WordPress Picture source set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$img_src = wp_get_attachment_image_url($picture, 'medium'); | |
$img_srcset = wp_get_attachment_image_srcset($picture); | |
?> | |
<picture> | |
<img src="<?php echo esc_url($img_src); ?>" srcset="<?php echo esc_attr($img_srcset); ?>"> | |
</picture> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment