Home Forums Front-end Issues WordPress 4.4 responsive images Reply To: WordPress 4.4 responsive images

  • Again, I’m sure this could be improved upon but here’s what I’ve ended up with.

      $image = get_sub_field('image_field_name');
      $imageID = $image['ID'];
      echo wp_get_attachment_image( $imageID, 'full', false, array( 'class' => 'lazyload', 'data-sizes' => 'auto' ) );

    This works for images that are set to return the image array (this is how all my fields are currently set up). I’ve included the lazysizes jquery plugin ( on my site which will lazyload images and update the image’s sizes attribute to match its container rather that what WordPress seems to be doing by default which seems to be an arbitrary value.