Get a picture element instead of an image tag for responsive images on your WordPress site.
Author: | Ethan Clevenger (profile at wordpress.org) |
WordPress version required: | 4.0 |
WordPress version tested: | 4.4.32 |
Plugin version: | 1.0.4 |
Added to WordPress repository: | 16-06-2015 |
Last updated: | 04-10-2016
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
Rating, %: | 0 |
Rated by: | 0 |
Plugin URI: | |
Total downloads: | 1 371 |
Active installs: | 20+ |
Click to start download |
This plugin introduces a couple of nifty functions to replace the_post_thumbnail()
& get_the_post_thumbnail()
in exchange for the responsive picture
element. Use:
get_the_post_picture(
$fallback_image_size,
array(
$breakpoint_1=>$image_size_1,
$breakpoint_2=>$image_size_2
)
[, $id, $atts]
);
For example:
<?php echo get_the_post_picture(
'single-featured-sm',
array(
'(min-width:768px)'=>'single-featured-md',
'(min-width:992px)'=>'single-featured-lg',
'(min-width:1200px)'=>'single-featured'
)
); ?>
While this says 4.0 for minimum version, I would wager it’ll be fine on most older installations.
FAQ
ChangeLog