<?php //remove this line
/**
* Enqueue scripts for a specified Gravity Form (13 = ID) and then
* embed Gravity Form at the bottom of single property listings
*
* http://www.gravityhelp.com/documentation/page/Gform_enqueue_scripts
* http://www.gravityhelp.com/documentation/page/Embedding_A_Form#Function_Call
*
* @author Carrie Dils
* @link http://www.carriedils.com/
*/
// Add scripts for Gravity Forms with ID 13
gravity_form_enqueue_scripts( 13, true );
// Call function to add form to bottom of the entry
add_action( 'genesis_entry_footer', 'wap_add_contact_form', 5 );
// Return Gravity Form with specified ID to single listing CPT
function wap_add_contact_form() {
// bail if we aren't on a single listing CPT
if ( ! is_singular( 'listing' ) ) {
return;
}
// display Gravity Form with ID 13
gravity_form( 13, true, false, false, '', false );
}
<?php //remove this line
/**
* Return title of current post for single property listing
* Dynamic population for Gravity Forms (dynamic population parameter = property_name)
* http://www.gravityhelp.com/documentation/page/Using_Dynamic_Population
*
* @author Carrie Dils
* @link http://www.carriedils.com/
*/
add_filter( 'gform_field_value_property_name', 'wap_populate_post_title' );
function wap_populate_post_title( $value ) {
// bail if we aren't on a single listing CPT
if ( ! is_singular( 'listing' ) ) {
return;
}
// fetch the post title
$title = get_the_title();
// return value escaped
return esc_html( $title );
}