Docs & Support

Learn about all Business Directory’s features and get support from our amazing customer success team.

CustomizationsHooks – For Developers
wpbdp_contact_form_output

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

Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2010-2025 S11 Directories, LLC.

    Complete your purchase
    Special offer unlocked.
    Get 55% OFF!
    Complete Purchase
    Join 20,000+ using Business Directory Plugin to build website directories fast. Get Started