• Resolved Kim Vinberg

    (@dicmdk)


    I made changes to the plugin on one of my sites, and suggest this change for the plugin itself.

    in file: classes/functions.php around line 430 this code is present:

    
                $class = $class ? ' class="'.$class.'" ' : '';
                return '<img loading="lazy" '.$class.$alt.' src="'.wp_get_attachment_image_url( $attach_id, $size ).'" />';
    

    My change is the following:

    
                $class = $class ? ' class="'.$class.'" ' : '';
                $srcset = wp_get_attachment_image_srcset( $attach_id );
                return '<img srcset="'.esc_attr( $srcset ).' loading="lazy" '.$class.$alt.' src="'.wp_get_attachment_image_url( $attach_id, $size ).'" />';
    

    What this does is adding srcset to the images, making a PageSpeed score higher and loadtimes faster.

Viewing 1 replies (of 1 total)
  • Plugin Contributor Jakir Hasan

    (@jakirhasan)

    Hi @dicmdk,

    Thank you for using our PostX plugin. We already informed our development team about your suggestion. I hope they will look take care of it.

    Have a nice day.

Viewing 1 replies (of 1 total)
  • The topic ‘Suggested change to get_image function’ is closed to new replies.