Caldera Forms -- Responsive, drag and drop form builder.

This filter can be used to add additional classes to the HTML element that contains the form.

add_filter( 'caldera_forms_render_form_wrapper_classes', 'slug_add_cf_wrapper_classes', 10, 2 );
function slug_add_cf_wrapper_classes( $form_wrapper_classes, $form ) {

    //add form ID as class
    $form_wrapper_classes[] = $form[ 'ID' ];

    //add form slug as class
    $form_wrapper_classes[] = strtolower( sanitize_title( $form['name'] ) );

    //add something arbitrary as a class
    $form_wrapper_classes[] = 'my-fancy-form';

    return $form_wrapper_classes;


Where Does This Code Go?

When using WordPress hooks to customize Caldera Forms or other plugins you should not modify the plugin files, or you will lose your changes when you update the plugin. Instead you should create a small plugin to hold the custom code. It's easy, learn how here.

Technically you can add the custom code to your theme's functions.php, but then you will not be able to change your theme and keep these customizations.

Learn More