Skip Navigation

[Closed] Conditionally display post reference field

This support ticket is created 4 years 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 4 years ago.

Assisted by: Christian Cox.

Author
Posts
#1866527

Tell us what you are trying to do?
I'm trying to conditionally display a post-reference field if it's not empty. I tried using this but it didn't work

[wpv-conditional if="([wpv-post-url item='@story-link.parent'] ne '')"](read more)[/wpv-conditional]

But if I try to display the URL alone without condition, this DOES work:

[wpv-post-url item="@story-link.parent"]

Is there any documentation that you are following?
Some posts here in the forums

Is there a similar example that we can see?
Not really

What is the link to your site?
hidden link

#1866829

Hi, it looks like an issue in the syntax of the conditional clause. The wpv-post-url shortcode should be enclosed in quotation marks, and you should probably alternate nested single and double quotation marks like this:

[wpv-conditional if="('[wpv-post-url item="@story-link.parent"]' ne '')"](read more)[/wpv-conditional]

If the problem is not resolved, turn on debugging like this:

[wpv-conditional if="('[wpv-post-url item="@story-link.parent"]' ne '')" debug="true"](read more)[/wpv-conditional]

Then reload the page on the front-end and copy the debug information. Paste that information into your next reply and I'll give you some more feedback.

The topic ‘[Closed] Conditionally display post reference field’ is closed to new replies.