Forked from spivurno/gw-gravity-forms-post-excerpt-content-template.php
Created
September 5, 2016 04:10
-
-
Save phillipwilhelm/793e81c3e764ae563f67624ef4c75d6a to your computer and use it in GitHub Desktop.
Gravity Wiz // Gravity Forms // Content Template for Post Excerpt Field
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 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