wpbdp_contact_form_output

Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don’t provide support for code customizations or 3rd party development.

Make changes to the contact form on the listings pages, or completely replace it.

Usage

add_filter( 'wpbdp_contact_form_output', 'bd_contact_form', 10, 2 );

Parameters

  • $form (string) – The content for the listing contact form
  • $atts (array)
    • $atts[’listing_id’] (int)

Examples

Replace contact form with Formidable

Create a custom contact form with Formidable Forms to use on the listing page. Replace 33 in the example with the ID of your form.

add_filter( 'wpbdp_contact_form_output', 'bd_frm_contact_form', 10, 2 );
function bd_frm_contact_form( $form, $atts ) {
	$listing_id = $atts['listing_id'];
	$send_to = wpbusdirman_get_the_business_email( $listing_id );
	return do_shortcode( '[formidable id=33 listemail="' . esc_attr( $send_to ) . '"]' );
}

To connect the form to the listings, you’ll need a few fields in the contact form.

  • Add a hidden field with the default value [get param=listemail]. Use this hidden field for the recipient email address.
  • Get the listing name for use in the email with a hidden field. Use the default value [post_title].

Get more information about default values in Formidable Forms.

Change Log

Added in version 5.8.2

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support