Skip to content

Instantly share code, notes, and snippets.

@Pebblo Pebblo/example.php
Last active Apr 9, 2019

Embed
What would you like to do?
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
<?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
You can’t perform that action at this time.