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!
Hi,
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:
https://toolset.com/documentation/legacy-features/views-plugin/using-shortcodes-in-conditions/
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"]
[/wpv-conditional]
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar