Adds Custom CSS Class into WP Fluent Forms Markup

Are you trying to add the custom CSS class into WP Fluent Form’s <form> HTML markup? You can easily do it without editing the code plugin. There have a filter fluentform_form_class to add the custom class into <form> tag.

I am sharing the PHP snippet at below. You will put it into functions.php file of your theme.

Adding Custom Class to All Forms

 add_filter( 'fluentform_form_class', 'paulc_fluentform_form_class', 10, 2 );
function paulc_fluentform_form_class( $formClass, $form ) {
    $formClass .= ' my-custom-form-class';
 
    return $formClass;
}

Adding Custom Class to Specific Form

If you want to add the custom class into your specific form, you can try this code. You will replace form ID 2 with your form ID into the code. You will get the form ID here:

  1. Navigate to Dashboard -> Fluent Forms Pro -> All Forms page
  2. You will get list of forms
  3. There have a column ID
  4. Get the ID of your form
 add_filter( 'fluentform_form_class', 'paulc_fluentform_form_class', 10, 2 );
function paulc_fluentform_form_class( $formClass, $form ) {
    if( $form->id == 2 ) {
        $formClass .= ' my-custom-form-class';
    }
 
    return $formClass;
}
This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.