Lighter Loading Spinner for Gravity Forms
Replaces the Gravity Forms AJAX loading spinner with a small inline SVG spinner in your brand color, with no extra file to download.
Opens WPIDE on
Code
$wpide_gf_spinner_color = '#2563eb';
add_filter( 'gform_ajax_spinner_url', function () use ( $wpide_gf_spinner_color ) {
$svg = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" fill="none" stroke="' . esc_attr( $wpide_gf_spinner_color ) . '" stroke-width="3" stroke-dasharray="42 15" stroke-linecap="round"><animateTransform attributeName="transform" type="rotate" from="0 12 12" to="360 12 12" dur="0.8s" repeatCount="indefinite"/></circle></svg>';
return 'data:image/svg+xml;base64,' . base64_encode( $svg );
} );
Notes
Change the color at the top; the spinner is embedded as a data URI.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.