Created
May 18, 2020 11:15
-
-
Save Pebblo/14acf044ca0a4aef2cc417be742f7400 to your computer and use it in GitHub Desktop.
Example of how to change the return to event list button displayed on the cart modal based on the terms set the event the ticket submission is for.
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 // Do not add the opening PHP tag if you already have one. | |
function tw_ee_mer_change_event_list_url_from_term($default_event_list){ | |
// Check if this is an ajax request. | |
if (wp_doing_ajax()){ | |
// Check we have an event id. | |
if (!empty($_POST['tkt-slctr-event-id'])) { | |
$EVT_ID = absint($_POST['tkt-slctr-event-id']); | |
if (has_term( 'courses-seminars', 'espresso_event_categories', $EVT_ID ) ){ | |
return 'https://domain.com/courses-seminars/'; | |
} elseif (has_term( 'summerschool', 'espresso_event_categories', $EVT_ID ) ) { | |
return 'https://domain.com/summer-school/'; | |
} | |
} | |
} | |
// Return the default event list url. | |
return $default_event_list; | |
} | |
add_filter( 'FHEE__EED_Multi_Event_Registration__set_definitions__events_list_url', 'tw_ee_mer_change_event_list_url_from_term' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment