Getting List of Event Categories

Home Forums Calendar Products Events Calendar PRO Getting List of Event Categories

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1189314
    Seth
    Participant

    I’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.

    #1189389
    Cliff
    Member

    Hi Seth.

    You might benefit from referencing:

    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.

    #1189632
    Seth
    Participant

    Thanks 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.

    #1189759
    Cliff
    Member

    Here’s a code snippet to help get you started:

    https://gist.github.com/cliffordp/36d2b1f5b4f03fc0c8484ef0d4e0bbbb

    I hope it helps.

    #1200320
    Support Droid
    Keymaster

    Hey 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

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Getting List of Event Categories’ is closed to new replies.