Add an Icon to the Opt-in Form Submit Button

Article Last Updated: March 9, 2016

Note: Requires Easy Forms for Mailchimp by YIKES v6.0.2.4 or greater.

The snippet below demonstrates how to add a dashiconto the submit button of your Mailchimp opt-in forms. The code snippet below should be placed at the bottom of your active themes functions.php file.

/*
*	Add a dashicon to the submit button
*	@submit_button_text
*	@form_id
*	@return	$submit_button_text
*/

function add_dashicon_to_submit_button( $submit_button_text, $form_id ) {
    wp_enqueue_style( 'dashicons' );
    return $submit_button_text . '';
}
add_filter( 'yikes-mailchimp-form-submit-button-text', 'add_dashicon_to_submit_button', 10, 2 );

To target a specific form, you can check which form is being displayed by ID. To only append an icon to the submit button of form ID 1, you can use the following. (you can change the form ID as needed)

/*
*	Add a dashicon to the submit button
*	@submit_button_text
*	@form_id
*	@return	$submit_button_text
*/

function add_dashicon_to_submit_button( $submit_button_text, $form_id ) {
    wp_enqueue_style( 'dashicons' );
    // change form with ID 1 only
    if( $form_id == 1 ) {
        return $submit_button_text . '';
    }
    return $submit_button_text;
}
add_filter( 'yikes-mailchimp-form-submit-button-text', 'add_dashicon_to_submit_button', 10, 2 );

The result of the code above will result in something similar to: