Navigation überspringen

[Gelöst] Show child post id on parent php template

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:
Show child post id on parent php template

Solution:
To get the related child post using PHP, you will require to use the function: toolset_get_related_post() [for single child post]
=> https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post

OR
toolset_get_related_posts() [for multiple child posts]
=> https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts

Relevant Documentation:
- https://toolset.com/documentation/customizing-sites-using-php/displaying-child-posts/#displaying-child-post-contents

This support ticket is created vor 4 Jahren. 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von aitorS vor 3 Jahren, 12 Monaten.

Assistiert von: Minesh.

Author
Artikel
#1962443
Captura de pantalla 2021-02-22 a las 10.49.20.png

I am developing a content template using PHP, in a section where I am developing a slider I would need to show the POST ID of the child CPT in the parent CPT template

#1962723

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

To get the related child post using PHP, you will require to use the function: toolset_get_related_post() [for single child post] or toolset_get_related_posts() [for multiple child posts]
=> https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post

Please check the following Doc that illustrates how you can display the custom field belongs to your child post:
- https://toolset.com/documentation/customizing-sites-using-php/displaying-child-posts/#displaying-child-post-contents

#1965703

My issue is resolved now. Thank you!