GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-post_excerpt-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default post_excerpt field output template.
4  *
5  * @global \GV\Template_Context $gravityview
6  * @since 2.0
7  */
8 
9 if ( ! isset( $gravityview ) || empty( $gravityview->template ) ) {
10  gravityview()->log->error( '{file} template loaded without context', array( 'file' => __FILE__ ) );
11  return;
12 }
13 
14 if ( ! empty( $gravityview->field->dynamic_data ) && ! empty( $gravityview->entry['post_id'] ) ) {
15 
16  global $post;
17 
18  /** Backup! */
19  $_the_post = $post;
20 
21  $post = get_post( $gravityview->entry['post_id'] );
22 
23  if ( empty( $post ) ) {
24  gravityview()->log->error( 'Dynamic data for post {post_id} does not exist.', array( 'post_id' => $gravityview->entry['post_id'] ) );
25  $post = $_the_post;
26  return;
27  }
28 
29  setup_postdata( $post );
30  the_excerpt();
31  wp_reset_postdata();
32 
33  /** Restore! */
34  $post = $_the_post;
35 
36 } else {
37  echo $gravityview->display_value;
38 }
global $post
Definition: delete-entry.php:7
gravityview()
The main GravityView wrapper function.