Query example for custom field filter in events bar?

Home Forums Calendar Products Events Calendar PRO Query example for custom field filter in events bar?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #86095
    indizio
    Participant

    Hey everyone!

    I want to achieve the following:
    1. Hook into the tribe events bar and add a new checkbox filter (as described in: https://theeventscalendar.com/understanding-the-tribeeventsbar/)
    2. Filter the events with this new filter depending on a custom field (“myspecialfield”, checkbox, values “yes” and “no”)

    Is there a code example for modifying the query like this? I couldn’t find anything in the forums, but I think some people maybe did this already?

    Thanks in advance!

    Best regard,
    Matthias

    #86130
    Barry
    Member

    I think some team members were preparing an example of adding a new view, which might give you a few ideas. Bear with me and I’ll see if there is a link we can provide.

    #86138
    Barry
    Member

    OK, so I was thinking of the following tutorial:

    https://theeventscalendar.com/using-the-stub-plugin-to-create-new-views/

    It doesn’t cover exactly what you are asking, but should give you some ideas about building something that meets your own needs. Hope that helps!

     

     

    #86171
    indizio
    Participant

    Hey Barry,

    thanks for the links & quick support! Unfortunately there is no example for my case. I just need assistance when it comes to the following line:
    $query->query_vars[‘my_var’] = $_REQUEST[‘tribe-bar-my-field’];

    Because i have no idea which query var should be used to access the custom field.

    #87657
    Barry
    Member

    I’m afraid it’s up to you to solve that part of the problem. I don’t know what your checkbox is intended to control, so that makes it difficult to offer suggestions as to how the query should be modified – and, as an advanced customization, it’s really something we have to leave in your hands.

    If you like, we can certainly provide you with a list of freelancers/independent developers who may be able to offer more complete assistance if you need additional support on this one?

    #87749
    indizio
    Participant

    Hey Barry,

    thanks for taking your time! I totally understand your arguments and really appreciate that you (and the other members of the support team) doing such a good job!

    My problem is just really simple, so I thought the devs of the tribe team or the support could give me a quick hint:

    The checkbox just triggers whether events with with a custom wordpress field (standard built-in function http://codex.wordpress.org/Custom_Fields) should be shown (or not).

    As example:
    Event 1 (custom field “is-special-event”, value: true)
    Event 2 (custom field “is-special-event”, value: true)
    Event 3 (custom field “is-special-event”, value: false)

    Checkbox-Filter “Only Special Events?”
    Checkbox: on – shows events 1,2
    Checkbox: off – shows events 1,2,3

    Cheers,
    Matthias

    #88783
    Barry
    Member

    OK, I see. So taking a look at custom field params within a WordPress query is going to be a good starting point here – but, again, I’m afraid we really need to leave the rest up to you 🙂

    Good luck!

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Query example for custom field filter in events bar?’ is closed to new replies.