I can add a class to the body easy enough but how can I add the form id to the body class?
// Add current Gravity Form ID body class
add_filter( 'body_class', 'gform_id_body_class' );
function gform_id_body_class( $classes ) {
$formID = ???;
$classes[] = 'gform_id_' . $formID;
return $classes;
}
I would like to style global elements on the page that are outside of the Gravity Form wrapper. If I had a class in the body based on the form ID, I could target those elements.
You could try using some standard PHP code to search the $post->post_content for the form wrapper CSS id, that contains the form id number (e.g. gform_wrapper_5 ).