Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add custom button classes to Event Espresso 4 submit form inputs
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action('template_redirect', 'my_change_venue_details');
function my_change_venue_details() {
global $post;
if(!class_exists('EE_Registry')) {
if (
$post instanceof WP_Post
&& $post->post_type == 'espresso_events'
|| is_page(EE_Registry::instance()->CFG->core->reg_page_id)
) {
add_filter('the_content', 'my_uikit_add_button_classes', 999, 1);
function my_uikit_add_button_classes($content) {
$patterns = array();
$patterns[0] = 'class="spco-next-step-btn';
$patterns[1] = 'ticket-selector-submit-ajax';
$patterns[2] = 'view-details-btn';
$replacements = array();
$replacements[0] = 'class="spco-next-step-btn uk-button uk-button-primary';
$replacements[1] = 'ticket-selector-submit-ajax uk-button uk-button-primary';
$replacements[2] = 'view-details-btn uk-button uk-button-primary"';
$content = str_replace($patterns, $replacements, $content);
return $content;
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.