Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spivurno/b5c7af4635b781c5bdf9 to your computer and use it in GitHub Desktop.
Save spivurno/b5c7af4635b781c5bdf9 to your computer and use it in GitHub Desktop.
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;
}
@spivurno
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment