GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-post_id-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default post ID 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 $display_value = $gravityview->display_value;
15 $entry = $gravityview->entry->as_entry();
16 
17 // Link to the post URL?
18 if ( $gravityview->field->link_to_post && ! empty( $entry['post_id'] ) ) {
19 
20  echo gravityview_get_link( get_permalink( $entry['post_id'] ), esc_html( $display_value ) );
21 
22 } else {
23 
24  echo esc_html( $display_value );
25 
26 }
if(! isset( $gravityview)||empty( $gravityview->template)) $display_value
The default post ID field output template.
gravityview_get_link( $href='', $anchor_text='', $atts=array())
Generate an HTML anchor tag with a list of supported attributes.
$entry
gravityview()
The main GravityView wrapper function.