Description
Use this filter to modify or replace the default Gravity Forms progress bar (for multi-page forms).
Usage
Apply to all forms.
add_filter( 'gform_progress_bar', 'my_custom_function', 10, 3 );
Apply to specific forms.
// template
add_filter( 'gform_progress_bar_{formId}', 'my_custom_function', 10, 3 );
// target form ID 1
add_filter( 'gform_progress_bar_1', 'my_custom_function', 10, 3 );
Parameters
- $progress_bar string
Progress bar markup as an HTML string. - $form Form Object
Current Form object. - $confirmation_message string
The confirmation message to be displayed on the confirmation page.
Examples
1. Generate custom progress bar markup
add_filter( 'gform_progress_bar', function( $progress_bar, $form, $confirmation_message ) {
$progress_bar = '<ul>
<li>Page 1</li>
<li>Page 2</li>
<li>Page 3</li>
</ul>';
return $progress_bar;
}, 10, 3 );
2. Replace Step with Level
add_filter( 'gform_progress_bar', function( $progress_bar, $form, $confirmation_message ) {
$progress_bar = str_replace( 'Step', 'Level', $progress_bar );
return $progress_bar;
}, 10, 3 );
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 2.0.
Source Code
This filter is located in the GFFormDisplay class in form_display.php.