Using regular categories for events

Home Forums Calendar Products Events Calendar PRO Using regular categories for events

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #962051
    Gilles
    Participant

    I am using regular categories for events (instead of events categories, see code below). Everything works fine except that when I click on a category assigned to some event, the category page comes up empty. I am guessing that it is looking through regular posts and not tribe_events. Checking the ‘Add events to main loop’ box does not help.

    Any idea how to fix that?

    // Make events support regular categories
    add_action( 'init', 'wpa_categories_for_events' );
    function wpa_categories_for_events(){
      register_taxonomy_for_object_type( 'category', 'tribe_events' );
    }
    #962103
    Barry
    Member

    Hi Gilles,

    You’d need to modify the default query generated by WordPress for those pages.

    The way we handle this for post tags, for instance, is by adding tribe_events to the query’s post_type argument during the parse_query action:

    github.com/moderntribe/the-events-calendar/blob/3.9.3/lib/tribe-event-query.class.php#L47-L65

    In your situation, you’d need to take a similar approach but apply it to regular categories.

    I hope that helps 🙂

    #962277
    Gilles
    Participant

    Okay, that’s what I thought and did. Thank you for the reply!

    #962296
    Barry
    Member

    Great 🙂

    In that case I’ll go ahead and close this topic — but of course please don’t hesitate to open new support topics as needed should anything else crop up.

    Thanks again!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Using regular categories for events’ is closed to new replies.