[Gelöst] Show Parent Field in the Child Single Post
Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.
Problem:
How to show fields from parent posts when creating a PHP template for child posts?
Solution:
When you create templates with Views or Layouts you can set the context to the parent post when outputting fields with the id shortcode attribute.
You can employ a similar technique when directly editing PHP templates with the types_render_field function, passing the ID attribute as an array:
This support ticket is created vor 6 Jahre, 3 Monate. There's a good chance that you are reading advice that it now obsolete.
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.
It's not clear from that page, but you can specify the same id='$twi-vendor' parameter directly in the function types_render_field, equivalent to the types shortcode, but used directly in the PHP template.
So you can add this to your single-twi-package.php template and it should output the field of the parent:
For standard fields such as the featured image field you would need to use the technique shown in the linked documentation page to get the id of the parent post using the function wpcf_pr_post_get_belongs();
Try updating your template according to the guide and let me know how you get on.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.