Problem:
Using conditional shortcodes, how could you test a child post to determine whether its parent post was of one post type or another?
Solution:
In the context of a child post you can refer to fields of the parent by adding the item attribute to shortcodes, e.g.
[wpv-post-title item="@relationship-slug.parent"]
So you can add a conditional shortcode that tests whether the parent title from a particular relationship is empty or not; that will tell you whether the parent is of a particular post type.
Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/
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 |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)