How can we help?
Hide/Show registration button on specific events
Not all your events require a Registration Button/ tab. For such events users can hide the registration button in WP Event Manager.
There are certain events for which organizers do not want people to register and this is when they need to hide the registration button.
Here are the steps that need to be followed to show or hide the registration button for specific events:
The below-mentioned code is used in the Functions.php file of the child theme to disable or enable the Registration tab for specific events.
- Open your child theme function.php.
- Add this following code:
/** * registration_limit_restriction * @param $method,$post * @return $method * @since 3.1.11 */ function your_child_theme_registration_disable($method,$post){ $disable_button = get_post_meta($post->ID,'_show_hide_registration_button',true); //disable button if settings in event meta box if( $disable_button == 1){ return false; }else{ return $method; } } add_filter('display_event_registration_method','your_child_theme_registration_disable',90,2); add_filter('get_event_registration_method','your_child_theme_registration_disable',90,2); add_filter( 'submit_event_form_fields', 'show_hide_registration_button' ); function show_hide_registration_button( $fields) { $fields['event']['show_hide_registration_button'] = array( 'label' => __( 'Show Hide Registration Button', 'wp-event-manager-registrations' ), 'type' => 'checkbox', 'required' => false, 'priority' => 22, ); return $fields; }
Please note after adding the code, there will be an Enable/disable Registration box on the right hand sidebar.This will help you enable and disable the registration button on the event detail page.