Last active
November 26, 2015 21:53
-
-
Save funzeye/f48f7363ac9aeaa1e618 to your computer and use it in GitHub Desktop.
How To Use Responsive Images in WordPress using Advanced Custom Field's image field and the wp-tevko-responsive-images Plugin
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
<figure> | |
<?php | |
$image = get_field('your_image_field_name'); | |
$atts = array( | |
'imageid' => $image, | |
'size1' => '0', | |
'size2' =>'600', | |
'size3' =>'1000' | |
); | |
echo tevkori_responsive_shortcode($atts) ; ?> | |
<figcaption><?php echo get_cat_name($value); ?></figcaption> | |
</figure> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the code I use in conjunction with the
You will need to create an image field in ACF and be sure to set the 'return value' to Image ID.
(You can ignore the figure elements above, just left them in there to help give some context to the important code - from lines 3 to 10)
Some background on the tevko responsive image plugin: http://css-tricks.com/hassle-free-responsive-images-for-wordpress/#comment-1581891
Note that in this article Chris uses the old version of Picturefill, while the Tevko plugin now uses the Picturefill 2.0 code.