1. Home
  2. Car Demon Code Docs
  3. Form Filters
  4. cd_form_subscribe_filter

cd_form_subscribe_filter

This filter will allow you to add extra fields or HTML to any of the Car Demon contact forms. This filter is located right before the submit button, making it an ideal place to add a “subscribe” checkbox or even a custom message for your visitors.

apply_filters( ‘cd_form_subscribe_filter’, $html, $type, $location, $post_id );

Parameters

$html -The current HTML for the form.
$type -The form currently being filtered: contact_us, finance, parts, qualify, service_appointment, trade_form, contact_us_vehicle, email_a_friend
$location – The vehicle location if known. If not known or does not apply then this will be either ‘unk’ or an empty string.
$post_id – The post id for the current vehicle if known. If not known or does not apply then this will be 0.

add_filter( 'cd_form_subscribe_filter', 'my_form_subscribe', 10, 3 );
function my_form_subscribe( $html, $type, $location ) {

    $html .= '<input type="checkbox" name="subscribe" /> Subscribe';
    $html .= '<br />';
    $html .= 'Call us today!';
    $html .= '<br />';
    return $html
}

The above example will add a checkbox named “subscribe” and under that it places a message that says “Call us today!”

Was this article helpful to you? Yes No

How can we help?