Showing only the events from one category

Home Forums Calendar Products Events Calendar PRO Showing only the events from one category

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #19990
    Robert
    Participant

    Is there a code, or other way, to show only the events from one category in a page?

    Robert

    #20016
    Jonah
    Participant

    Hi Robert, if you paste this code into your functions.php file you can filter what categories are displayed in the calendar:

    /*-----------------------------------------------------------------------------------*/
    /* Exclude a category from the calendar
    /*-----------------------------------------------------------------------------------*/

    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('presentations'),
    'operator' => 'IN'
    )
    )
    );
    }

    return $query;

    }

    Make sure to change ‘presentations’ to the name of your category.

    – Jonah

    #20034
    Robert
    Participant

    That’s not what I want.
    I want to show only 1 category in a page, not on the calender.
    I want to show everything on the calender.
    I want to take out 1 category and show it on a different page, let’s say page1.

    Robert

    #20058
    Rob
    Member

    Hi there Robert. Thanks for the follow-up; sorry to hear that didn’t meet your needs. If you wanted to show specific categories within your content (but independent of the broader calendar) you may want to check out our template tag documentation, as it should point you in the right direction to do so. That can be found at https://theeventscalendar.com/support/documentation. We also just published a themer’s guide that is pretty in-depth and may help you out. It’s at https://theeventscalendar.com/themers-guide-to-the-events-calendar/.

    Good luck! Let us know if you have any other questions from there.

    #976987
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Showing only the events from one category’ is closed to new replies.