Skip to content

Instantly share code, notes, and snippets.

@matty0501
Created April 22, 2024 14:10
Show Gist options
  • Save matty0501/363477a510bdbb9689639d9025b8b28a to your computer and use it in GitHub Desktop.
Save matty0501/363477a510bdbb9689639d9025b8b28a to your computer and use it in GitHub Desktop.
<?php
/**
* Gravity Perks // Populate Anything // Populate JetSloth with ACF Image Field
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*
* Instructions:
*
* 1. Go to the field settings for the Gravity Forms choice field you are populating.
* 3. Add "gppa-jetsloth-acf-image" to the "Custom CSS Class" setting (on the Appearance tab).
*
*/
add_filter( 'gppa_input_choice', function( $choice, $field, $object, $objects ) {
if ( strpos( $field->cssClass, 'gppa-jetsloth-acf-image' ) === false ) {
return $choice;
}
$choice['imageChoices_image'] = wp_get_attachment_image_url( $choice['imageChoices_image'] );
return $choice;
}, 20, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment