Home › Forums › Calendar Products › Events Calendar PRO › Getting List of Event Categories
- This topic has 5 replies, 4 voices, and was last updated 9 years, 4 months ago by
Seth.
-
AuthorPosts
-
November 8, 2016 at 12:41 pm #1189314
Seth
ParticipantI’m writing a custom widget and I want the user to be able to select a category from a dropdown list, however, I can’t seem to find out how to get that list.
I’ve tried several versions of get_terms() with ‘tribe_events_cat’ but no luck.
November 8, 2016 at 3:41 pm #1189389Cliff
MemberHi Seth.
You might benefit from referencing:
- wp_dropdown_categories() — see the “taxonomy” argument — you can see it in use here: https://github.com/moderntribe/the-events-calendar/blob/4.3.2/src/admin-views/aggregator/settings.php#L10-L15
- https://frankiejarrett.com/2011/09/create-a-dropdown-of-custom-taxonomies-in-wordpress-the-easy-way/ may also be of some help (just found it Googling)
I hope this gets you headed in the right direction for your custom coding. Please let me know if you have any follow-up questions on this topic.
November 9, 2016 at 8:09 am #1189632Seth
ParticipantThanks for the reply Cliff. However, in my specific case that might not work.
I’m making a custom Beaver Builder module to display events, and their framework requires dropdown questions to be defined a certain way in their settings.
Here’s an example of the output I need to create for the module settings:
'event_categories' => array( 'type' => 'select', 'label' => __( 'Choose a Category', 'fl-builder' ), 'default' => 'all', 'options' => array( 'all' => __( 'All Events', 'fl-builder' ), 'public' => __( 'Public', 'fl-builder' ), 'students' => __( 'Students', 'fl-builder' ), 'faculty' => __( 'Faculty', 'fl-builder' ), [... rest of categories ...] ), ),So I think I need to get an array of the categories so that I can output them in this specific way.
November 9, 2016 at 9:31 am #1189759Cliff
MemberHere’s a code snippet to help get you started:
https://gist.github.com/cliffordp/36d2b1f5b4f03fc0c8484ef0d4e0bbbb
I hope it helps.
December 1, 2016 at 8:35 am #1200320Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Getting List of Event Categories’ is closed to new replies.
