[Resolved] I need archive to get filtered by latest value of ancestor
This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I have post hierarchy Events->session->presentations. In presentations "archive view" I put ancestor filters events>session.
I put default_value of session filters as "--select--". Note that I haven't put a default_value for Events.
When I open the archive url the page displays all the presentations. I want to filter the presentations by latest Event in select box by default in presentation archives.
I understand what you are saying now. Actually this would be possible to do with a custom hook, however this will disable the frontend filters and allow them to only display the results for the latest parent and all the other filters will re-adjust for that. You won't be able to select any other parent except the one that has been pre-filtered for since the hierarchy for filters means that the hook will always take priority.
So essentially its not possible without some trade off.
I think this should how the standard method work.
I got another idea for workaround. Is it possible to not display result first time the archive page is opened. So that a user will use filters to fetch the results.
For testing purpose I include following filter in my functions.php but it didn't worked. I understood that $query_args contains WP_Query args and I applied same args type.