Embed calendar in page but only show one category

Home Forums Calendar Products Events Calendar PRO Embed calendar in page but only show one category

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #14286
    Trevor
    Member

    Hi, I’m able to embed a calendar into a page template with tribe_calendar_grid(), but I need to edit it so the calendar only shows one category… is that possible?

    #14358
    Rob
    Member

    It should be. Have you checked out our documentation at https://theeventscalendar.com/support/documentation, to see if that points you in the right direction? Let me know if not and I can get a dev to take a look.

    #14360
    Trevor
    Member

    Yep, been looking through the KB and FAQ… This is all it lists for that function. It doesn’t appear to offer a way to pass any variables (like the category).

    Calendar Grid (Display)
    tribe_calendar_grid()
    Display the full size grid calendar table

    Returns
    void
    More Info
    since: 2.0
    uses: load_template()

    #14390
    Trevor
    Member

    I tried using:

    set_query_var(‘eventCat’,6);
    tribe_calendar_grid();

    I’m thinking I need to modify the table.php file, but I can’t figure out the best way to do that, and I’m not sure how to override that file.

    #14399
    Rob
    Member

    Alright, thanks for confirming. I’ll get Jonah to take a look this afternoon.

    #14415
    Jonah
    Participant

    Hey Trevor,

    You should be able to do this by editing table.php like you suspected. First make a duplicate copy and place in an ‘events’ folder in your theme if you don’t already have one. Then on line 20 modify:


    $eventPosts = tribe_get_events(array( 'eventDisplay'=>'month' ));

    to:


    $eventPosts = tribe_get_events(array(
    'eventDisplay'=>'month',
    'tax_query'=>array(
    array(
    'taxonomy' => 'tribe_events_cat',
    'field' => 'id',
    'terms' => 4,
    'operator' => 'IN'
    )
    )
    ));

    Where ‘4’ for terms is the ID of your event category you want to include.

    #18303
    Javier
    Participant

    Can I do the same in the table-mini?

    #18305
    Jonah
    Participant

    Yes, the same thing can be done in table-mini. Just make a copy of /wp-content/plugins/the-events-calendar/views/table-mini.php and place in the ‘events’ folder in your theme. On line 12 is where tribe_get_events is called so just modify the parameters being passed in there and you’re good to go!

    #18320
    Javier
    Participant

    @Jonah Thanks Jonah! I’ve got another discussion opened, is really important for me, it is for a SEO purpose.

    category in the slug

    Thanks

    #18342
    Rob
    Member

    Thanks for confirming this did the trick, Javier. Per my note a minute ago we’ll respond to your other thread as soon as we can.

    #976671
    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 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Embed calendar in page but only show one category’ is closed to new replies.