Skip to content

Instantly share code, notes, and snippets.

@matty0501
Created July 7, 2023 18:31
Show Gist options
  • Save matty0501/d451c35f8cf656bc197cbfd14de6ec00 to your computer and use it in GitHub Desktop.
Save matty0501/d451c35f8cf656bc197cbfd14de6ec00 to your computer and use it in GitHub Desktop.
<?php
/**
* Gravity Perks // Populate Anything // Populate Pipe Video URL
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*
* By default, when populating a Pipe field's value, the Pipe add-on returns an array which includes the video URL and a thumbnail.
* This snippet allows you to just populate the video URL.
* Just add the "gppa-pipe-video" CSS class to the populated field's CSS Class Name setting.
*/
add_filter( 'gppa_process_template_value', function( $template_value, $field ) {
if ( strpos( $field->cssClass, 'gppa-pipe-video' ) !== false ) {
$parts = explode(',', $template_value);
$template_value = str_replace( ' ', '', $parts[1] );
}
return $template_value;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment