Skip Navigation

[Résolu] Conditional for Parent Featured Image

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

The issue is that the user wanted to get their parent post information, particularly the featured image.

Solution:
This can be done by having a look at the solution i've posted below.
https://toolset.com/forums/topic/conditional-for-parent-featured-image/#post-1197430

This support ticket is created Il y a 5 années et 10 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par toolset-dave Il y a 5 années et 10 mois.

Assisté par: Shane.

Auteur
Publications
#1197316

Hello,

I am trying to set up conditional for Parent Featured Image in Post which belongs to Company (CPT). Displaying the image works OK:

{!{wpv-post-featured-image item="@novinka-spolecnosti.parent"}!}

, but the problem is with conditional. I followed this https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/#checking-if-a-post-has-a-featured-image and I have added the item which links to parent. Both conditionals don´t work:

[wpv-conditional if="( NOT(empty($(_thumbnail_id item='@novinka-spolecnosti.parent'))) )"]
Image
[/wpv-conditional]
or
[wpv-conditional if="( NOT(empty($(_thumbnail_id) item='@novinka-spolecnosti.parent')) )"]
Image
[/wpv-conditional]

What I am doing wrong?

#1197430

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Dave,

Thank you for getting in touch.

There is an issue with the getting the parent information like this when using our conditional code.

What I recommend that you do is to perform it like this.

[wpv-conditional if="( '{!{wpv-post-featured-image item="@novinka-spolecnosti.parent" output="url"}!}' ne '' )"]
Image
[/wpv-conditional]

Please try this and let me know the results.

Thanks,
Shane

#1197658

My issue is resolved now. Thank you!