syntax to pass filters to TribeEventsAdvancedListWidget using "the_widget"

Home Forums Calendar Products Events Calendar PRO syntax to pass filters to TribeEventsAdvancedListWidget using "the_widget"

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #752957
    David Luyendyk
    Participant

    What is the syntax for passing filters to “TribeEventsAdvancedListWidget” via “the_widget”? I’m trying to pass multiple category IDs and it’s only grabbing events from the first one. It should match any.

    I’ve tried:

    
    $args = array( 'category' => '21,22' );
    the_widget('TribeEventsAdvancedListWidget', $args);
    

    I’m associating a CPT with related event categories, so I’m unable to use the widget interface to set this up and need to do it in PHP.
    Thanks in advance!

    #753388
    Barry
    Member

    Great question!

    We don’t actually have any tutorials or learning resources on this one as, for the vast majority of customers, this is handled behind the scenes when the widget is deployed more traditionally via WordPress’s Appearance → Widgets admin screen.

    If you want to dig into the code and see how to express categories/tags (it involves some JSON) I’d recommend looking in the following spots:

    • TribeEventsAdvancedListWidget::taxonomy_filters() (events-calendar-pro/lib/widget-advanced-list.class.php:28)
    • TribeEventsPro_Widgets::form_tax_query() (events-calendar-pro/lib/Widgets.php:11)

    You might also want to take a peek at Event Rocket. This is a third party plugin which we do not support here on the Modern Tribe forums, but it allows you to embed core and PRO widgets via a shortcode – with a fairly simple syntax for specifying categories, etc.

    Though I appreciate you are interested in a programmatic solution rather than a shortcode, you could make use of WordPress’s do_shortcode() function and potentially have the best of both worlds – or indeed you could strip out the logic it uses and pull it in to your own solution.

    I hope that helps!

    #753428
    David Luyendyk
    Participant

    Awesome answer – thanks for your help Barry!

    I ended up going with a combo of Event Rocket and do_shortcode() which does exactly what I need.

    #753935
    Barry
    Member

    Excellent, I’m happy to hear that helped 🙂

    I’ll go ahead and close this thread as it sounds like you’re good to go, but if we can assist with anything else please don’t hesitate to let us know by opening a new thread – one of the team will be only too happy to help.

    That apart, if you have a moment to spare and wished to leave a note on our plugin review page we’d love to hear from you: thanks again!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘syntax to pass filters to TribeEventsAdvancedListWidget using "the_widget"’ is closed to new replies.