Exclude Event Category in Calendar only List view is still showing

Home Forums Calendar Products Events Calendar PRO Exclude Event Category in Calendar only List view is still showing

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1471555
    Peter
    Participant

    Dear Sirs,

    I am currently using the following in my functions.php file see below. What i want to do is excluded the category “pop-up-listing” from the calendar view only, ensuring that the list view remains active and this category is included can you please help
    *
    * The Events Calendar Remove Events from Month and List Views
    * add coding to theme’s functions.php
    * @version 3.12
    * modify here with event category slugs: array( ‘concert’, ‘convention’ )
    */
    add_action( ‘pre_get_posts’, ‘tribe_exclude_events_category_month_list’ );
    function tribe_exclude_events_category_month_list( $query ) {

    if ( isset( $query->query_vars['eventDisplay'] ) && ! is_singular( 'tribe_events' ) ) {
    
        if ( $query->query_vars['eventDisplay'] == 'list' && ! is_tax( Tribe__Events__Main::TAXONOMY ) || $query->query_vars['eventDisplay'] == 'month' && $query->query_vars['post_type'] == Tribe__Events__Main::POSTTYPE && ! is_tax( Tribe__Events__Main::TAXONOMY ) && empty( $query->query_vars['suppress_filters'] ) ) {
    
            $query->set( 'tax_query', array(
    
                array(
                    'taxonomy' => Tribe__Events__Main::TAXONOMY,
                    'field'    => 'slug',
                    'terms'    => array('pop-up-listing'),
                    'operator' => 'NOT IN'
                )
            ) );
        }
    
    }
    
    return $query;
    

    }

    #1472422
    Patricia
    Member

    Hi Peter,

    I’m closing this thread as we are already discussing the same subject on:

    Exclude A Certain Category of Events showing in Calendar View

    If you have any other questions please refer to that thread and I’ll be happy to assist!

    Thanks,

    Patricia

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Exclude Event Category in Calendar only List view is still showing’ is closed to new replies.