Last active
August 29, 2015 14:04
-
-
Save apisandipas/6a2a292ba5e6eff1e955 to your computer and use it in GitHub Desktop.
With Retina.js in the mix, retina images are picked up automagically.
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 | |
| $images = get_children(array( | |
| 'post_parent' => get_the_ID(), | |
| 'post_type' => 'attachment', | |
| 'post_mime_type' => 'image', | |
| ); | |
| if ( $images ) : ?> | |
| <?php foreach( $images as $image ) : ?> | |
| <span data-picture> | |
| <span data-src="<?php echo wp_get_attachment_image_src($image->ID, 'small'); ?>"></span> | |
| <span data-src="<?php echo wp_get_attachment_image_src($image->ID, 'medium'); ?>" data-media="(min-width: 769px)"></span> | |
| <span data-src="<?php echo wp_get_attachment_image_src($image->ID, 'large'); ?>" data-media="(min-width: 991px)"></span> | |
| <noscript> | |
| <img src="<?php echo wp_get_attachment_image_src($image->ID, 'medium'); ?>"/> | |
| </noscript> | |
| </span> | |
| <?php endforeach; ?> | |
| <php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment