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 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.

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 6 months ago.

Assigned support staff: Luo Yang.



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.


Luo Yang

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

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

section "Using the Types API"

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