This support ticket is created Il y a 4 années et 7 mois. 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.
Tell us what you are trying to do?
I build a restaurant menu using repeater field and cpt.
Each menu section is a different post with and ID and slug.
I try to output if my field (nombre-de-morceaux) is empty and came from the post ID 205/slug sushi-sashimi that is a parent of this repeater field.
Hi Shane,
I want to display a text if a certain field (nombre-de-morceaux) is empty AND the parent Id is 205.
The case :
I have a CPT called Sushi menu.
Each meal section is a post of sushi menu.
In every meal/post, there is the sushi items coming as a repeater field.
So in this view
if the field "nombre-de-morceaux" from the repeater field "items-au-menu-sushi" is empty
AND
the repeater field is display from post id 205
THEN
display my text
Assuming that you are already displaying the items from the repeater fields. The parent you want to check the ID for is the post that the repeatable field is attached to correct?
If so then Its not possible to get the ID of the post that the repeatable fields are attached to.
Good morning Shane,
oh, that's bad. Can I check by some other way the post that contain the repeater field?
Any workeround ? If not id, I suppose the slug will not do neither...
I know in our latest views Beta you are able get the ID of the parent post type. However since this is a Beta i'm not certain if the code will work in a conditional field.
If you had done this as a post relationship then we would've been able to get the parent ID in the current version of views without any issues at all.