Skip Navigation

[Resolved] How do I wrap a post reference inside of a conditional?

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.

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

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 1 year, 8 months ago.

Assisted by: Waqar.


I have a custom post type, VIDEOS

One of the fields for a video post is "Related Page". This is set up as a "Post Reference" which lets me pick any other page on the website.

On my video content template, I know that I can display a linked title of the related page like this:

<h3>Related Page</h3>
{!{wpv-post-link item="@related-page.parent"}!}

However, not all videos have a related page. I only want to show the <h3>Related Page</h3> header if there's actually a related page that will be displayed.

Is there a simple way to use conditionals to check for whether or not this video has a Related Page? Something like

IF this video's related page field isn't blank
THEN show <h3>Related Page</h3> and the wpv-post-link

Thank you!



Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)


Thank you for contacting us and I'd be happy to assist.

You can use the [wpv-post-id item='@related-page.parent'] in a conditional statement, to check whether the ID of the related page is equal to empty or not:

For example, the following conditional statement will only show the enclosed content, if the related parent page's ID is not equal to 'empty':

[wpv-conditional if="( '[wpv-post-id item='@related-page.parent']' ne '' )"]

<h3>Related Page</h3>
[wpv-post-link item="@related-page.parent"]

I hope this helps and please let me know if you need any further assistance around this.


This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.