Last active
April 9, 2019 15:31
-
-
Save Pebblo/d321818666fb1ba33140558744fe9b82 to your computer and use it in GitHub Desktop.
Example of how to add custom classes to some of the EE buttons, The first function adds a 'qbutton' class to the ticket selector submit button, the second adds a 'qbutton' class to the SPCO checkout buttons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Please do not include the opening PHP tag if you already have one. | |
function tw_add_class_to_ts_button_with_js(){ | |
wp_add_inline_script( | |
'ticket_selector', | |
'jQuery( document ).ready(function($) { | |
jQuery(".ticket-selector-submit-btn").addClass("qbutton"); | |
});' | |
); | |
} | |
add_filter('wp_enqueue_scripts', 'tw_add_class_to_ts_button_with_js', 11 ); | |
add_filter('FHEE__EE_Form_Input_Base___construct__input_args', 'tw_ee_custom_button_class', 10, 2); | |
function tw_ee_custom_button_class($input_args, $input_obj) { | |
if( | |
!empty($input_args['html_class']) | |
&& strpos($input_args['html_class'] , 'spco-next-step-btn') !== false | |
&& $input_obj instanceof EE_Submit_Input | |
) { | |
$input_args['html_class'] = $input_args['html_class'] . ' qbutton'; | |
} | |
return $input_args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment