Skip Navigation

[Resolved] conditional output based on parent CPT in a Fields and Text block

This support ticket is created 4 years, 4 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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by TorstenR3514 4 years, 4 months ago.

Assisted by: Nigel.

Author
Posts
#1748943

Tell us what you are trying to do?
I am trying to display the url form a parent CPT, by conditional output if the field is not empty

Is there any documentation that you are following?

Is there a similar example that we can see?
I have to kind of singin information. One which is stored in the CPT I am displaying (Veranstaltung/event) and on who is stored in the parent CPT (Veranstalter/organizer)
I can display the url-anmeldung-veranstalter with a conditional output that checks if the field is empty:
[wpv-conditional if="( NOT(empty($(wpcf-url-anmeldung-veranstalter))) )"]

But i dont get it if i want to display the singin information from the parent CPT.
neigther
[wpv-conditional if="( '[types field="url-anmeldung-veranstalter" item="@einzelveranstalter-veranstaltung.parent"]' eq '' )" evaluate="false"]
nore
[wpv-conditional if="( NOT(empty($(wpcf-url-anmeldung-veranstaltung))) )"]
work

What is the link to your site?

please remove <- directory protection user:pw lurum:1234566 ->

singin information in CPT Veranstaltung, works fine
see "Anmeldung & Kosten"
hidden link

sigin information in parent CPT Veranstalter, dont works, two versions
hidden link

#1753261

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Torsten

The format the condition should be in to test the custom field from the parent should be like so:

[wpv-conditional if="( NOT ( empty( $(wpcf-url-anmeldung-veranstaltung).item(@einzelveranstalter-veranstaltung.parent) ) ) )"]

(The block editor is much improved and lets you insert such conditions using the UI. You can then see what the condition itself looks like with the advanced editor.)

#1753857

ja sry missed the ".item(@einzelveranstalter-veranstaltung.parent)"

The problem with the Add Conditional Output insight the Text and Fields Block is that it has no Empty value like when using the Conditional Block.

Neighter I can choose a parent relation, just "from the current post"

So the best solution seems to be:
1. adding a conditional-block
2. setting the conditions
3. edit as html
4. copy conditonal tag
5. paste it in the html editor of the Text and Fields Block.

Is it that what you meant with your last sentence?

Well 😉

#1755103

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Kind of, yes.

From your question I understood that you weren't using a conditional block and that you were using the legacy interface. You are using Blocks, but the Fields and Text block displays the legacy interface for conditions, which is less complete and often needs editing. If you don't know the format required (not something you are likely to carry around in your head), then copying and pasting it from a Conditional Block that you later dispose of is likely the best solution.

#1755247

My issue is resolved now. Thank you!