Created
September 18, 2014 07:34
-
-
Save andrescifuentesr/38bdc173ff323d9e0035 to your computer and use it in GitHub Desktop.
Picture Element
This file contains 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 //different sizes ?> | |
<?php $large_image_urlLarge = wp_get_attachment_image_src( get_post_thumbnail_id(), 'imgBlogLarge' ); ?> | |
<?php $large_image_urlMedium = wp_get_attachment_image_src( get_post_thumbnail_id(), 'imgBlogMedium' ); ?> | |
<?php $large_image_urlSmall = wp_get_attachment_image_src( get_post_thumbnail_id(), 'imgBlogSmall' ); ?> | |
<?php //title == alt ?> | |
<?php $title = get_post(get_post_thumbnail_id())->post_title; //The Title ?> | |
<picture> | |
<!--[if IE 9]><video style="display: none;"><![endif]--> | |
<source srcset="<?php echo $large_image_urlLarge[0];?>" media="(min-width: 912px)"> | |
<source srcset="<?php echo $large_image_urlMedium[0];?>" media="(min-width: 400px)"> | |
<source srcset="<?php echo $large_image_urlSmall[0];?>"> | |
<!--[if IE 9]></video><![endif]--> | |
<img srcset="<?php echo $large_image_urlLarge[0];?>" alt="<?php echo $title; ?>"> | |
</picture> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment