nelson

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Gridview Based On Category #17987
    nelson
    Member

    Have placed the function above >
    /**
    * Exclude a specific category from Events Grid View
    *
    * @author jkudish
    * @uses pre_get_posts filter
    * @param object $query the query object
    * @return object $query the filtered object
    */
    add_action( ‘pre_get_posts’, ‘exclude_events_category’ );
    function exclude_events_category( $query ) {

    if ( $query->query_vars[‘post_type’] == TribeEvents::POSTTYPE && $query->query_vars[‘eventDisplay’] == ‘month’ && !is_tax(TribeEvents::TAXONOMY) && empty( $query->query_vars[‘suppress_filters’] ) ) {
    $query->set( ‘tax_query’, array(
    array(
    ‘taxonomy’ => TribeEvents::TAXONOMY,
    ‘field’ => ‘slug’,
    ‘terms’ => array(‘membersevents’),
    ‘operator’ => ‘IN’
    )
    ) );
    }
    return $query;
    }

    into a page with the gridview code in it and it is working perfectly by showing only category X events…. Until selecting the next or prior month – then the calendar reverts back to ALL categories of events. Looking to figure how to carry the “show only this category” along with the change in month. Even choosing event list reverts back to show all events.

Viewing 1 post (of 1 total)