Hi there,
This is a continuation from the final post in the previous thread at: https://toolset.com/forums/topic/display-a-relationship-connected-repeater-field-group-from-another-cpt/
Summary: I have two CPTs in a relationship, and I am looking to retrieve metadata from the main CPT (parent?) This was successfully achieved (Thanks, Shane!) but I am running into a small issue where because it is a _nested View_ and I am filtering it based off the "Current Post in the Loop", the Item attribute that I would use to "break out" of the Repeater Field Group to pull back the Custom Field on that CPT does not work.
[types field="unit-of-time-base-duration" item="$current_page"][/types]
I have tried to change the attribute value to $parent, @widget-faq.parent, @widget-faq.child, etc. But have not been able to successfully access the Custom Field of the relationship-link CPT.
The link to show you some details and what I've tried: hidden link
Please let me know if you have any questions. Thank you!
Hi,
Thank you for sharing these details and the correct usage of the item attribute, in this case, would be item="@sw-deal-tiers.parent":
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/ )
[types field="unit-of-time-base-duration" item="@sw-deal-tiers.parent"][/types]
This shortcode video shows how you can select the correct source for the post-selection when using the "Fields and Views" interface: hidden link
regards,
Waqar
Hi Waqar,
Took a look at the View and it looks like the item attribute was set correctly, but the field was still not pulling back correctly. 🙂
Shown here: hidden link
Thanks for writing back.
In my last reply, I just wanted to show you the correct usage of the item attribute in this case and as an example only updated it in one view "Field - Deal Price ⟩ Tier 2 from Software CPT (relative to Local Loop)" (ID: 231).
If you'll go and check the view "Field - List Price ⟩ Tier 2 from Software CPT (relative to Local Loop)" (ID: 247), which is responsible for showing the List Price, you'll see that item="$current_page" is still being used in there.
You can update the item attribute there and then it will show correctly.
One thing that I'll recommend though is that you don't need two separate views to show the Deal Price and List Price in this case since they both are set to show the data from the same target post. You could have used the same view to show the shortcodes for both these fields, and any other fields from the same post.
My issue is resolved now. Thank you Waqar for such wonderful support!