Skip to content

Instantly share code, notes, and snippets.

@wplit
Last active December 14, 2020 02:31
Show Gist options
  • Select an option

  • Save wplit/64d16ed0a570755fb84f98156170092b to your computer and use it in GitHub Desktop.

Select an option

Save wplit/64d16ed0a570755fb84f98156170092b to your computer and use it in GitHub Desktop.
function for 'PHP function return value' when using image component inside flickity
/*
*
* Attribute name: data-flickity-lazyload-srcset
* Attribute value: PHP function return value -
* function name: flickityLazySRCSET
* function args: $field_name,$size
*/
function flickityLazySRCSET($field_name,$size) {
$image = get_field($field_name);
$image_src = '';
if( $image ) {
$image_src .= wp_get_attachment_image_srcset($image,$size);
}
return $image_src;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment