Help Desk

Preventing Multiple Categories in 'Submit an Event'

  • Posts: 2 Topics: 3
    | Permalink

    Hello, I am having good success with Submit an Event.

    I have a requirement to restrict the user from selecting multiple categories in their events. That is: Required to select one category but no more than one. I was able to set the field to ‘required’.

    Is there a method available to code this up together with the ‘required’ flag?

    Cheers,
    Yehuda

    • This topic was modified 1 month, 2 weeks ago by  Yehuda.
    Posts: 3319 Topics: 4
    | Permalink
    Correct Answer

    Hi Yehuda!

    Thanks for getting in touch with us! Let me help you with this topic.

    First, please let me note that we are fairly limited in how much support we can give for custom development questions like that.

    That said, we always like helping out and at least point users into the right direction as much possible.

    I would suggest overriding the taxonomy.php template to make that happen. You can learn more about overriding calendar templates in our Themer’s Guide, but it basically boils down to this:

    • Make a copy of the taxonomy.php template. It is located at wp-content/plugins/the-events-calendar-community-events/src/views/community/modules/taxonomy.php
    • Make a new folder in your theme called tribe-events
    • Make a new folder in that one called community and another on inside it called modules
    • Drop your copied taxonomy.php file in that last folder

    Now that the template is in your theme, you can modify it to suit your needs. In this case, You should delete line 91 which is the attribute “multiple” that allows for multiple selection of categories.

    Will this work for you? Please let me know. 🙂

    Best,
    Victor

    Posts: 2 Topics: 3
    | Permalink

    Hello Victor,

    Only perfect! Thanks for the assist.

    Cheers,
    Yehuda

    Posts: 3319 Topics: 4
    | Permalink

    Hey Yehuda!

    Glad to be of help! 🙂

    I’ll close this now, but feel free to open a new topic if anything comes up and we’ll be happy to help.

    Cheers,
    Victor

    | Permalink

The topic ‘Preventing Multiple Categories in 'Submit an Event'’ is closed to new replies.