that allows me to filter offers by the parent request post (which is called "demande" in the code).
The view is on the single page for the request post type, so it shows only offers for the actual request.
But that's not really what I want : a request is made about a product. Then some offers are registered in answer to this request, and for the same product.
So "product" is parent of both "request" and "offer" post types, and "request" is parent of "offer".
Now I need the filter to be applied on parent product of the request, and not on the request itselft.
Thank you for contacting Toolset support. I am not quite clear on what you are trying to achieve here and which type of limit you would like to apply?
Please provide step by step details (1, 2, 3, 4, etc) so I can understand and suggest you some approach to do that. A simple example would also be nice.
We would like to re-emphasize that the function you have provided is custom one, and we cannot consult on the custom code as it is out of our support policy. https://toolset.com/toolset-support-policy/
When you need custom coding which extends Toolset functionality, we recommend contacting one of Toolset certified service providers: https://toolset.com/consultant/
At times we do provide small code snippets but mostly in cases that can be done quickly in a matter of few minutes. Modifying relational data through code requires more time and more code which we won’t be able to provide. Thanks
I have 3 custom post types :
PRODUITS
DEMANDES (child of PRODUITS)
OFFRES (child of both PRODUITS and DEMANDES)
The code given allows to filter a view by his parent : among all OFFRES only show children of current DEMANDE.
What I would need is to change this to : among all OFFRES only show children of same PRODUIT that is also parent of current DEMANDE
But since OFFRES is also child of DEMANDES, it may be simplier like this : amond all OFFRES only show grandchildren of parent product of actual DEMANDES
Thank you for providing more details and explanation. I am still working on it and trying to see what we can achieve in this case. I will soon update you with my findings.
I have achieved the desired results using Views filters, so we don’t need code at this point, please backup & remove the code you have added for now. Please follow below steps:
1. I have created a View for Offers and add query filter (Post relationship filter) -- see attached screenshot: Step 1.
2. Create Content Template (e.g. Template for RDemanes) >> assign it to Demands CPT >> and insert Offers View with current Demenad Parent (Product) ID in attribute -- see attached screenshot: Step 2.
3. Now check Demand Single page - (make sure Content Template is applied, see attached screenshot: Step 3.).
Amazing.
Views and Content Templates really are amazing when you know how to use it !
Thank you very much ; this is the best solution I could've think of !