Last active
December 14, 2020 02:31
-
-
Save wplit/64d16ed0a570755fb84f98156170092b to your computer and use it in GitHub Desktop.
function for 'PHP function return value' when using image component inside flickity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * | |
| * 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