Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created March 5, 2019 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/c26e98e095dbe1fbf90ac036c0af91ca to your computer and use it in GitHub Desktop.
Save joshfeck/c26e98e095dbe1fbf90ac036c0af91ca to your computer and use it in GitHub Desktop.
Add custom button classes to Event Espresso 4 submit form inputs
<?php
//* 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')) {
return;
}
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