Skip to main content

How to Display Child Posts on Parent Post Pages and Vice Versa

This guide will walk you through displaying child posts on a parent single post page, or displaying parent posts on a child single post page. Follow these steps to set up relationships and queries for a seamless parent-child post display.

Updated over 12 months ago

Step 1: Create a Relationship Between Custom Post Types (CPTs)

  1. Begin by connecting the two Custom Post Types (CPTs) you want to link as parent and child items.

  2. Follow this guide on creating relationships between posts to establish the connection.


Step 2: Display Child Posts on the Parent Post Page

  1. Set Up the Query:

    • Go to JetEngine Query Builder and create a new Posts Query.

    • In the General tab, select your Child CPT and specify the post status.

    • Set up the query to retrieve related items:

  2. Use the Query:

    • Now, you can use this query as a custom query in the listing where you want the child posts to appear.


Step 3: Display Parent Posts on the Child Post Page

  1. Set Up the Query in Query Builder:

    • Open the JetEngine Query Builder and create a Posts Query for the parent post type.

    • In the General tab, select your Parent CPT.

    • Use the "Related Items" macro to link the parent post to the current child post:

  2. Add Parent Listing to Child Post Page:

    • Finally, add the parent listing to the child post page (or to a child post listing) and apply the custom query.


Following these steps, you can display child posts on a parent post page or parent posts on a child post page using JetEngine's Query Builder.
​

Did this answer your question?