Skip to content

Instantly share code, notes, and snippets.

@gugaalves
Created September 17, 2021 19:39
Show Gist options
  • Save gugaalves/5be5a7bfba15c16ca5fe371aadae6fe5 to your computer and use it in GitHub Desktop.
Save gugaalves/5be5a7bfba15c16ca5fe371aadae6fe5 to your computer and use it in GitHub Desktop.
Events Calendar [Free] [PRO] - Add Category Tags to List, Month and Map Views
// Source: https://theeventscalendar.com/knowledgebase/k/add-category-tags-to-list-view/
// Remove "Event Categories" label from tribe_get_event_categories function
function tec_remove_category_label( $html, $post_id, $args, $categories ) {
$html = ! empty( $categories ) ? sprintf(
'%s%s%s',
$args['wrap_before'],
$categories,
$args['wrap_after']
) : '';
return $html;
};
add_filter( 'tribe_get_event_categories' , 'tec_remove_category_label' , 10, 4 );
// Inject tribe_get_event_categories() after the title
add_action('tribe_template_after_include:events/v2/list/event/title','tec_custom_event_categories');
add_action('tribe_template_after_include:events/v2/month/[EDIT]','tec_custom_event_categories');
add_action('tribe_template_after_include:events/v2/map/event-cards/event-card/event/title','tec_custom_event_categories');
function tec_custom_event_categories() {
echo tribe_get_event_categories();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment