Title: Code Validation
Last modified: August 22, 2016

---

# Code Validation

 *  Resolved [shecodes](https://wordpress.org/support/users/shecodes/)
 * (@shecodes)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/code-validation-2/)
 * Uhoh. Last week the code validated. This week it’s not : (
 * I’ve implemented the new code change, and updated the plugin this morning, but
   still failing validation across all images through the media uploader, feature
   image and ACF custom image field. Getting this error:
 * When the srcset attribute has any image candidate string with a width descriptor,
   the sizes attribute must also be present.
 * Is it ok to ignore, or can I (how would I) fix it?
 * [https://wordpress.org/plugins/ricg-responsive-images/](https://wordpress.org/plugins/ricg-responsive-images/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [Joe McGill](https://wordpress.org/support/users/joemcgill/)
 * (@joemcgill)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/code-validation-2/#post-5787589)
 * Hi Nathalie,
 * The validation notice you’re seeing is due to a recent change to the responsive
   images spec. We have a fix in the works. In the mean time, if you are using `
   tevkori_get_srcset_string` to build your own image tags, you can manually add
   a `sizes` attribute that meets your needs. Some examples from the spec can be
   found here:
 * [https://html.spec.whatwg.org/multipage/embedded-content.html#introduction-3:viewport-based-selection-2](https://html.spec.whatwg.org/multipage/embedded-content.html#introduction-3:viewport-based-selection-2)
 *  [Shapeshifter 3](https://wordpress.org/support/users/shapeshifter-3/)
 * (@shapeshifter-3)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/code-validation-2/#post-5787611)
 * shecodes,
 * IF your question was answered sufficiently, it would be advantageous to other
   viewers, to have you log back in and marked this particular thread as RESOLVED.
 *  Thread Starter [shecodes](https://wordpress.org/support/users/shecodes/)
 * (@shecodes)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/code-validation-2/#post-5787620)
 * Hi Joe
 * Thanks for your comment, I’m not going mad then! I did try manually adding a ‘
   sizes’ attribute as per an article I’d found in the meantime over on [css tricks](http://css-tricks.com/responsive-images-youre-just-changing-resolutions-use-srcset/)
   by using what I have assumed is a default value sizes=”100vw”. So that sorts 
   my custom image fields created with the ACF plugin.
 * I gather that for now, sit tight until there’s a plugin update to resolve for
   feature images and the images uploaded into posts?
 * This is what I had done:
 *     ```
       <?php 
   
       if (get_field('custom_image') != '') {
       $image = get_field('custom_image');
       //vars
       $url = $image['url'];
       $id = $image['id'];
       $alt = $image['alt'];
       echo "<img alt='$alt' sizes='100vw' src='$url' ";
       echo tevkori_get_srcset_string( $id, 'full' );
       echo "/>";
       }
   
       ?>
       ```
   
 *  Plugin Contributor [Joe McGill](https://wordpress.org/support/users/joemcgill/)
 * (@joemcgill)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/code-validation-2/#post-5787632)
 * The way your handling it should work fine. However, if you know the layout size
   of the image you can probably improve the value you’re using in the sizes attribute.
 * For a very detailed explanation of how this should work, check out this article
   by Eric Portis: [http://ericportis.com/posts/2014/srcset-sizes/#part-2](http://ericportis.com/posts/2014/srcset-sizes/#part-2)
 * Hope that helps.
 *  Thread Starter [shecodes](https://wordpress.org/support/users/shecodes/)
 * (@shecodes)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/code-validation-2/#post-5787633)
 * Ha thanks Joe, although I’m not sure I’ve progressed much from the pea spewing
   image! Appreciate your help though.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Code Validation’ is closed to new replies.

 * ![](https://ps.w.org/ricg-responsive-images/assets/icon.svg?rev=1119324)
 * [RICG Responsive Images](https://wordpress.org/plugins/ricg-responsive-images/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ricg-responsive-images/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ricg-responsive-images/)
 * [Active Topics](https://wordpress.org/support/plugin/ricg-responsive-images/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ricg-responsive-images/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ricg-responsive-images/reviews/)

## Tags

 * [breakpoints](https://wordpress.org/support/topic-tag/breakpoints/)
 * [default](https://wordpress.org/support/topic-tag/default/)
 * [featured images](https://wordpress.org/support/topic-tag/featured-images/)
 * [media settings](https://wordpress.org/support/topic-tag/media-settings/)
 * [picturefill](https://wordpress.org/support/topic-tag/picturefill/)
 * [RICG](https://wordpress.org/support/topic-tag/ricg/)
 * [sizes](https://wordpress.org/support/topic-tag/sizes/)
 * [srcset](https://wordpress.org/support/topic-tag/srcset/)
 * [validation](https://wordpress.org/support/topic-tag/validation/)
 * [W3C](https://wordpress.org/support/topic-tag/w3c/)

 * 5 replies
 * 3 participants
 * Last reply from: [shecodes](https://wordpress.org/support/users/shecodes/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/code-validation-2/#post-5787633)
 * Status: resolved