Home › Forums › Calendar Products › Events Calendar PRO › syntax to pass filters to TribeEventsAdvancedListWidget using "the_widget"
- This topic has 3 replies, 2 voices, and was last updated 9 years, 8 months ago by Barry.
-
AuthorPosts
-
September 19, 2014 at 7:23 am #752957David LuyendykParticipant
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!September 19, 2014 at 11:13 am #753388BarryMemberGreat 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!
September 19, 2014 at 11:39 am #753428David LuyendykParticipantAwesome 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.
September 19, 2014 at 5:15 pm #753935BarryMemberExcellent, 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!
-
AuthorPosts
- The topic ‘syntax to pass filters to TribeEventsAdvancedListWidget using "the_widget"’ is closed to new replies.