Problem: I would like to display some text and a custom field from a parent post within in my child post, but only if the child post has a parent post defined. If no parent is defined, I do not want to display anything here.
Solution: You can use the $parent-slug operator in a wpv-post-title or wpv-post-id shortcode to get information from a parent post type. If a parent of this post type is not defined, these fields are designed to fall back to display the child post. So, you can use a conditional that tests both IDs. If they are identical, then the parent is not defined. If they are different, then you know the parent is defined and the conditional is true.
[wpv‐conditional if="( '[wpv-post-id id='$client']' ne '[wpv-post-id]' )"] [wpv-post-link id='$client'] [/wpv‐conditional]
Relevant Documentation: https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
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)
This topic contains 2 replies, has 2 voices.
Last updated by 7 years, 3 months ago.
Assisted by: Christian Cox.