Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gravity Wiz // Gravity Forms // Content Template for Post Excerpt Field
<?php
/**
* Gravity Wiz // Gravity Forms // Content Template for Post Excerpt Field
*
* Gravity Forms does not currently offer a "Content Template" option for the
* Exceprt field. This is a simple snippet that allows you to create
*/
// update "433" to the ID of your form
add_filter( 'gform_post_data_433', 'gw_post_excerpt_content_template_433', 10, 3 );
function gw_post_excerpt_content_template_433( $post_data, $form, $entry ) {
// modify this to include whatever merge tags and words you'd like included in the excerpt
$excerpt_template = '{Name (First):1.3} {Name (Last):1.6} tells a riveting tale about {Subject:3}.';
$post_data['post_excerpt'] = GFCommon::replace_variables( $excerpt_template, $form, $entry );
return $post_data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.