Forums › Forums › Search & Filter Pro › Post Meta Date Range
- This topic has 21 replies, 4 voices, and was last updated 6 years, 10 months ago by Ross.
-
Ross Moderator(Private) February 18, 2017 at 8:58 pm #91164
Hi Max
I’m not sure I follow, can you elaborate?
Thanks
Ross Moderator(Private) February 23, 2017 at 3:40 pm #92457Hi Max
As I mentioned, I hadn’t tested the code, merely pointed out something you were doing wrong.
You are adding a custom meta query, to our S&F query which is fine. But I am not able to validate if your meta query is correct or not.
The sf_edit_query_args should work no problem, so I suggest the problem lies in your code (and possibly the specifics of your meta query).
Why not create (seperate form all this S&F stuff), create a new WP_Query, with your meta query, and see if produces the desired results?
https://codex.wordpress.org/Class_Reference/WP_Query
The first example under “usage” should be fine, provided you set your post type and meta query in the
$args
.Once we know your meta query is correct and working properly we can have a look to see where the above is going wrong (please send me a link of it working).
Thanks
Anonymous(Private) August 17, 2017 at 12:06 pm #126386Can anyone give me a small example for the folowing? I have two search fields in the form. Both need to get a numebr to search for. But I want to make a calculation with the two: field1 x field 2 and use that also as a search argument.
Thanks,
Pter
Trevor(Private) August 17, 2017 at 1:48 pm #126415Peter, it might have been better to start a new thread. If you want me to do that, I can move this, but If you can think of a ‘Title’ for the thread?
As to the question, this is more complex than I can do. I will mark this for the attention our developer, Ross, to see if he can help, but I cannot promise anything. He will return from vacation shortly.
Anonymous(Private) August 17, 2017 at 3:21 pm #126441Well Trevor, I think it is not that advanced, and I already posted this one somewhere else and I hope to find people who could gave some help.
I am glad I have the right hook, it is now just about getting the tow meta fields from the searchfields, make a calcuation and use the result in the search.
I know it is easy to say, but I know I am close to a solution in this thread……
Thanks,
Peter
Ross Moderator(Private) September 4, 2017 at 2:40 pm #129047Hi Peter
Currently you cannot use multiple search fields in a form.
This is coming in v3.
There might just be a hacky way to do this using filters etc buy I imagine it would be incredibly fragile and is not something I’ve tried to do before.
I’m currently working on v3, which is huge update so it is some time away yet.
Thanks
Anonymous(Private) September 14, 2017 at 8:10 am #130914Hi Ross,
Let me explain in detail what I want to do:
I have two fields in ACF which I use in S&F. That is ‘height’ and ‘width’. Both fields are used in S&F to do the search. Nothing wrong so far and it works.
However the ‘height’ and ‘width’ fields also represent the surface (height x width). It would be strange if someone fills in the search form with height = 4 width = 2, that you should fill in the surface (8 in this case) yourself. So, the thing I want is some kind of hidden search field, which is calculated out of the requested height and width search field. Is that possible?
Kind Regards,
Peter
Ross Moderator(Private) January 28, 2018 at 3:31 pm #155362Hi Peter
Digging through some really old threads and saw this had slipped through the cracks.
Just to let you know, this is being worked on for v3 – well, we are going to allow you to create your own fields, so you should be able to achieve something similar to what you describe.
Best
-
AuthorPosts