Home › Forums › Calendar Products › Events Calendar PRO › Query example for custom field filter in events bar?
- This topic has 6 replies, 2 voices, and was last updated 12 years, 3 months ago by
Barry.
-
AuthorPosts
-
January 3, 2014 at 6:33 am #86095
indizio
ParticipantHey 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,
MatthiasJanuary 3, 2014 at 7:04 am #86130Barry
MemberI 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.
January 3, 2014 at 7:09 am #86138Barry
MemberOK, 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!
January 3, 2014 at 7:35 am #86171indizio
ParticipantHey 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.
January 6, 2014 at 4:59 pm #87657Barry
MemberI’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?
January 7, 2014 at 4:34 am #87749indizio
ParticipantHey 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,3Cheers,
MatthiasJanuary 8, 2014 at 1:29 pm #88783Barry
MemberOK, 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!
-
AuthorPosts
- The topic ‘Query example for custom field filter in events bar?’ is closed to new replies.
