Show hide events with different category in list view and calendar view

Home Forums Welcome! Pre-Sales Questions Show hide events with different category in list view and calendar view

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1101335
    Ella
    Guest

    Hi

    Is it possible to show events in a List view with a specific category e.g. external and show all events in the Calendar view that we would like to show for members only?

    #1101353
    Geoff
    Member

    Hi Ella and thanks for getting in touch!

    Yes, that is certainly possible, though I will caution that it will take some custom development on your end to make it happen.

    For example, here is a snippet that can be added to your functions.php file that will exclude specific categories in List View and that you can use a blueprint.

    Did you have any pre-sales questions I can help answer? Please let me know.

    Cheers,
    Geoff

    #1101462
    Ella
    Guest

    Thanks Geoff

    I added the code (only changed the category name to e.g. Internt) and I the events was hided in the list view, but how can I have it to be shown in the calendar view?

    // Removes categories “Internt” from list views
    add_action( ‘pre_get_posts’, ‘exclude_events_category’ );

    function exclude_events_category( $query ) {

    if ( $query->query_vars[‘eventDisplay’] == ‘list’ && !is_tax(TribeEvents::TAXONOMY) || $query->query_vars[‘eventDisplay’] == ‘month’ && $query->query_vars[‘post_type’] == TribeEvents::POSTTYPE && !is_tax(TribeEvents::TAXONOMY) && empty( $query->query_vars[‘suppress_filters’] ) ) {

    $query->set( ‘tax_query’, array(

    array(
    ‘taxonomy’ => TribeEvents::TAXONOMY,
    ‘field’ => ‘slug’,
    ‘terms’ => array(‘Internt’),
    ‘operator’ => ‘NOT IN’
    )
    )
    );
    }
    return $query;
    }

    #1101482
    Ella
    Guest

    This is how we would like to have it;

    Events with the category: External, should only be displayed in the list view,
    Events with the category: External and Internal should be displayed in the calendar view. Is it possible?

    BR
    Ella

    #1101911
    Geoff
    Member

    Hi Ella,

    You would remove this part of the condition:

    || $query->query_vars[‘eventDisplay’] == ‘month’

    I’d be happy to help further, but it looks like we’re getting much more into technical support than Pre-Sales and we only provide technical support for active license holders of our premium products. I’ll go ahead and close this thread, but do please feel free to purchase a license if you would like additional technical support. You are also free to search around the forums for answers, or check out our Knowledgebase.

    Cheers!
    Geoff

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Show hide events with different category in list view and calendar view’ is closed to new replies.