Hide and Add column from the Event Dashboard
An event dashboard displays all the details related to a specific event. A user can easily access the dashboard after logging into his or her account on WP Event Manager. The event dashboard column can be seen directly in the home page.
A user can hide or remove a field from the event dashboard page as per his or her requirements.
The user needs to follow the steps mentioned below to perform the task:
Hide Column
The following code has to be inserted in the Functions.php file of the child theme:
add_action('event_manager_event_dashboard_columns','wpem_event_manager_event_dashboard_columns', 10, 3); function wpem_event_manager_event_dashboard_columns($columns) { unset($columns['view_count']); return $columns; }
Let us take an example, say, as a user, you don’t want a field location on the dashboard.
Please enter the code:
add_filter('event_manager_event_dashboard_columns','your_theme_name_event_dashboard'); function your_theme_name_event_dashboard_columns($columns){ unset($columns['event_location']); return $columns; } }
ADD Column
The following code has to be inserted in the Functions.php file of the child theme to add column:
add_action('event_manager_event_dashboard_column_Your_array_key','your_theme_event_dashboard_value'); function your_theme_event_dashboard_value($event ){ echo 'Custom column value here'; }
Let us take an example, say, as a user, you want to add a field “Assigned To” as a Column heading and its value from meta_key “_organizer_email”.
Please enter the code:
add_filter( 'event_manager_event_dashboard_columns', 'add_assign_to_columns' ); function add_assign_to_columns( $columns ) { $columns['assign_to'] = __( 'Assign To', 'wp-event-manager' ); return $columns; } add_action( 'event_manager_event_dashboard_column_assign_to', 'assign_to_column' ); function assign_to_column( $event ) { global $post; echo get_post_meta($post->ID, '_organizer_email', true); }