Created
April 22, 2024 14:10
-
-
Save matty0501/363477a510bdbb9689639d9025b8b28a to your computer and use it in GitHub Desktop.
This file contains 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
<?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