spivurno
1/28/2015 - 2:14 AM

Gravity Wiz // Gravity Forms // Content Template for Post Excerpt Field

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;
}