Skip Navigation

[Resolved] Query content of both parent and child custom post types

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 9 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 9 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#276815

Hi,

I have 2 custom post types that are linked together:
- 1st custom post type: TV Shows
- 2nd custom post type: Videos
'Videos' custom post type is the child of 'TV shows'.

'TV shows' are composed of: Title, description, icon whereas 'Videos' include Title, Screenshot and URL.
I have 7 TV shows and lot of videos. Each video is linked to 1 TV show.

Here is what I would like to achieve:
I have a page that lists the 7 TV shows (kind of a 'Replay' category). I'd like to display in the same DIV (for every TV show):
- the Title of the TV show
- the icon of the TV show
- and the screenshot of the LAST video that belongs to the selected TV show

Could you please help me to query and display those linked posts?

Note that I'm not using "Views".

Thanks in advance.

#276941

I assume you are using Types to create both two post types.

You can try use PHP codes to query the child video posts, please check our document:
Displaying Fields of Child Posts
https://toolset.com/documentation/user-guides/display-fields-table-content-using-views-or-the-types-api/

section "Using the Types API"

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.