fbpx
Black Friday Offer 20% offUse Coupon Code blackfriday2020 shop Now

How can we help?

Hide and Add column from the Event Dashboard

Once the user is logged into his account on the WP Event Manager, he can witness the details of the event on the event dashboard column of the home page.

There are times when a user wants to remove/ hide a field option available default at the Event Dashboard page, in such scenario, the following steps need to be considered for Hiding and Add column from the Event Dashboard:

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 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);
}

Was this article helpful?
How can we improve this article?
Quick Links