Title: Support for srcset?
Last modified: October 5, 2017

---

# Support for srcset?

 *  [Lauren](https://wordpress.org/support/users/oncecoupled/)
 * (@oncecoupled)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/support-for-srcset/)
 * Is there planned support for srcset? It looks like that’s not enabled by default,
   but we’d like to take advantage of it!

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

 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/support-for-srcset/#post-9568365)
 * What kind of code do you have in mine. I am not overly familiar with srcset. 
   But, obviously happy to implement it to see how we can get it run better
 *  Thread Starter [Lauren](https://wordpress.org/support/users/oncecoupled/)
 * (@oncecoupled)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/support-for-srcset/#post-9577636)
 * Just the default WordPress implementation. I believe this is automatically added
   when using WordPress image functions, rather than manually outputting the  tag.
 * I didn’t read all the code, but theoretically replacing line 221 in media.php
   with wp_get_attachment_image() would work.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/support-for-srcset/#post-9587170)
 * I’ll see how `wp_get_attachment_image` is implemented but I think there is a 
   bit more needed to be done to get the srcset working. I’ll put this on my todo
   list to get it added in
 *  Thread Starter [Lauren](https://wordpress.org/support/users/oncecoupled/)
 * (@oncecoupled)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/support-for-srcset/#post-9769365)
 * Hey [@ajay](https://wordpress.org/support/users/ajay/) I did a quick test for
   my own purposes and thought I’d share:
 * Current implementation, which writes the img code: [https://ibb.co/eVLysw](https://ibb.co/eVLysw)
   `
   $output .= '<img src="' . $postimage . '" alt="' . $post_title . '" title="' .
   $post_title . '" ' . $thumb_html . ' class="' . $class . '" />';`
 * Localized test with use of `wp_get_attachment_image`, which automatically outputs
   srcset assuming appropriately sized thumbnails exist: [https://ibb.co/j9tweb](https://ibb.co/j9tweb)
 *     ```
       $attachment = tptn_get_attachment_id_from_url( $postimage );
       		$attr_args = array(
       			'title' => $post_title,
       			'class' => $class,
       		);
               $output .= wp_get_attachment_image( $attachment, 'thumbnail-standard-retina', false, $attr_args );
       ```
   
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/support-for-srcset/#post-9790187)
 * Thank you. I’ll take a look as well and see if I can get this to work within 
   the plugin as it is a useful feature.

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

The topic ‘Support for srcset?’ is closed to new replies.

 * ![](https://ps.w.org/top-10/assets/icon-256x256.png?rev=2986432)
 * [WebberZone Top 10 — Popular Posts](https://wordpress.org/plugins/top-10/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/top-10/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/top-10/)
 * [Active Topics](https://wordpress.org/support/plugin/top-10/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/top-10/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/top-10/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Ajay](https://wordpress.org/support/users/ajay/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/support-for-srcset/#post-9790187)
 * Status: not resolved