Add Font Awesome to Gravity Forms Submit Button

Plugins - Gravity Forms Classes / Styling Functions PHP

Snippet Overview

Add Font Awesome to Gravity Forms Submit Button

If you use Gravity Forms to build and manage forms within your WordPress site you know how powerful it can be. That said, sometimes customizing the front end display of forms is not as intuitive as one may think. This script merges the power of Gravity forms with the super awesome web icon resource Font Awesome.

To add font awesome icons to your Gravity Forms submit button add the code below to your theme’s functions.php file.

// filter the Gravity Forms button type

add_filter("gform_submit_button_1", "form_submit_button", 10, 2);
function form_submit_button($button, $form){
return "<button class='button' id='gform_submit_button_{$form["id"]}'><span><i class='fa fa-share fa-2x'></i> Send </span></button>";
}

//Change hook of gform_submit_button_X to the form that you are using 
//Change <span><i class='fa fa-share fa-2x'></i> Send </span> to Font awesome and text of your choice

Source: https://snippets.cacher.io/snippet/5238b9198326d3870d6b

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply