Hide and Add column from the Event Dashboard

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:

  1. add_action('event_manager_event_dashboard_columns','wpem_event_manager_event_dashboard_columns', 10, 3);         
  2.         function wpem_event_manager_event_dashboard_columns($columns)
  3.         {
  4.             unset($columns['view_count']);            
  5. return $columns;
  6. }

Let us take an example, say, as a user, you don’t want a field location on the dashboard.

Please enter the code:

  1. add_filter('event_manager_event_dashboard_columns','your_theme_name_event_dashboard');
  2. function your_theme_name_event_dashboard_columns($columns){
  3. unset($columns['event_location']);
  4. return $columns;
  5. }
  6. }

ADD Column

The following code has to be inserted in the Functions.php file of the child theme to add column:

  1. add_action('event_manager_event_dashboard_column_Your_array_key','your_theme_event_dashboard_value');
  2. function your_theme_event_dashboard_value($event ){
  3.  echo 'Custom column value here';
  4. }

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:

  1. add_filter( 'event_manager_event_dashboard_columns', 'add_assign_to_columns' );
  2. function add_assign_to_columns( $columns )
  3. {
  4.     $columns['assign_to'] = __( 'Assign To', 'wp-event-manager' );
  5.     return $columns;
  6. } 
  7. add_action( 'event_manager_event_dashboard_column_assign_to', 'assign_to_column' );
  8. function assign_to_column( $event )
  9. {
  10.     global $post; 
  11.     echo get_post_meta($post->ID, '_organizer_email', true);
  12. }