Forums › Forums › Search & Filter Pro › Querying posts by parent depending on $post->ID?
Tagged: $query_args, query results, sf_edit_query_args
- This topic has 18 replies, 3 voices, and was last updated 8 years, 5 months ago by
Anonymous.
-
Anonymous(Private) January 12, 2017 at 9:58 am #81579
Hi Trevor,
Have you been able to forward this message to the developer yet?
I have realised there is another method i could try to achieve what i want but this would require to create multiple search forms and then target their IDs individually using the sf_edit_query_args function.
I understand the developer is a busy man and i don’t want to be a pest but are you able to give an estimated time for when you think he’ll get a chance to look at it?
This is for a project i’m working on for a client in which the deadline is at the end of the month so if the waiting list is long then i don’t mind going for the alternative method.
Many thanks
Anonymous(Private) January 13, 2017 at 11:30 am #82027Hi Ross,
Thanks for getting back to me on this.
Unfortunately i can’t share a link to the site at the moment as i’m working on it locally but i will try and upload it live somewhere today so you can have a look at it.
And yes, it displays the posts associated with the $post->ID correctly when you first go to the page and also shows the search options for just those posts. It’s when i make a search it then defaults back to all posts 🙁
However, if i don’t include an if statement and just use the code below it then shows the posts under the $post->ID 54.
function filter_function_name( $query_args, $sfid ) { global $post; if($sfid==42) { $query_args = array ( 'post_parent__in' => array('54'), ); } return $query_args; } add_filter( 'sf_edit_query_args', 'filter_function_name', 10, 2 );
Ross Moderator(Private) January 13, 2017 at 11:51 am #82032Hey Shaun
Will await your update with a live link (it would be handy to have temp admin access too).
Also, we released an update to the plugin yesterday, can you update that too, there were quite a few bug fixes hoping there is some overlap with your issue.
Best
Anonymous(Private) January 17, 2017 at 4:13 pm #83156Hi Ross,
Did you manage to have a look at this?
I went back into the site today and it’s not working again. I think it may have something to do with the cache but no entirely sure.
If you could check it out and let me know what you think that’d be great.
Many thanks,
ShaunRoss Moderator(Private) January 17, 2017 at 11:15 pm #83258Hey Shaun
Sorry about the delay, I didn’t check out the issue as I thought it had kinda resolved itself.
I’ll be back on this in the morning.
Thanks
-
AuthorPosts