Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- This snippet disables the paypal gateway for events with event ID 123 and 321. You can modify the events to exclude and gateways to exclude in $events_to_exclude and $gateways_to_exclude respectively.
- This only works if your booking forms are showing on the specific event page, rather than via a shortcode or similar on another page.
- For information on implementing this snippet see this - http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/
- */
- function my_emp_disable_gateway($return){
- global $EM_Event;
- $events_to_exclude = array(123,321); //event ids you want excluding the following gateways
- $gateways_to_exclude = array('paypal'); //gateways you want excluded for the events above
- if( in_array($EM_Event->event_id, $events_to_exclude) ){
- foreach($gateways_to_exclude as $gateway){ //loop through active gateways
- unset($return[$gateway]); //removes gateway from the active gateways array
- }
- }
- return $return;
- }
- add_filter('option_em_payment_gateways','my_emp_disable_gateway', 10, 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement