safi_thumbnail_sizes_format [PRO]

Filters the “sizes” attribute string of the featured image

Default value:

sizes="(max-width: {{featured_image_max_display_width}}px) 100vw, {{featured_image_max_display_width}}px"

{{featured_image_max_display_width}} is the value set by the user in the settings.


  • $sizes_format: string sizes attribute generated by the plugin
  • $option: string value of the featured_image_max_display_width option
add_filter('safi_thumbnail_sizes_format ', function ($sizes_format, $option) {
    //Custom sizes attribute string
    $sizes_format = 'sizes="(max-width: 728px) 80vw, (max-width: 1000px) 100vw, 1000px"';

    return $sizes_format;
Was this page helpful?