stefanledin / responsify-wp

The WordPress plugin that cares about responsive images.
http://responsifywp.com
GNU General Public License v2.0
52 stars 8 forks source link

<img srcset="" sizes="px"> output #30

Open IvanPr opened 7 years ago

IvanPr commented 7 years ago

The rwp_img( $image_id, $rwp_settings); returns "" if the requested $rwp_settings produce no valid scrset of image-sizes [the image-sizes were not re-generated].

I would expect the FALSE result instead.

stefanledin commented 7 years ago

Hi! Does this happen when rwp_img() is unable to create an <img> element?

IvanPr commented 7 years ago

Yes, exactly. For example, when several image-sizes are specified in $rwp_settings but the image-sizes itself does not exist... say, were not re-generated after changing an image size...

stefanledin commented 7 years ago

I haven't tried this, but what if you try something like this:

<?php
add_filter( 'rwp_edit_generated_element', function( $element ) {
    if ( $element == '' ) return false;
    return $element;
} );
?>