Skip Navigation

[Resolved] Create list with 1 post type with another post type as a header

This support ticket is created 4 years, 11 months ago. 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 4 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1449275

Tell us what you are trying to do?
I have 2 post types 'Stove Company' and 'Stoves'. I have created a relationship where you can have many stoves listed to 1 stove company.

I want to list all the stoves in the 'Stove' post type under the heading I have got in the 'Stove Company'.

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?
hidden link

#1449483

I want to list all the stoves in the 'Stove' post type under the heading I have got in the 'Stove Company'.
Hi, it sounds like you want to create a list of Stove Companies, and inside that list you want to create a nested list of Stoves for each Stove Company. Am I understanding correctly? If so, you can do this with two nested Views. Please note that it is not currently possible to build nested views in the Block Editor, so you'll have to work in the Classic Editor to create a nested View structure. The result will be something like this:

-Stove Company 1
-- Stove 1
-- Stove 2
-- Stove 3
-Stove Company 2
-- Stove 4
-- Stove 5
-Stove Company 3
-- Stove 6
...etc...

- Create a View of Stoves and add a Post Relationship Query Filter. If you cannot see the Query Filter panel in your View editor, scroll to the top of the screen and click "Screen Options" to enable the panel.
- Set up the Post Relationship Filter so that the Stove Company - Stove post relationship is selected, and the parent post is set by the current post in the loop.
- In the Loop Output editor, build the design for the Stove list by inserting the post title, or post link, etc.
- Create another View, this one of Stove Companies. Do not add any Query Filters.
- In the View's Loop Output editor, add the Stove Company header. I'm not sure if you mean you want to display the Stove Company post title, or information from a custom field, but you should add that in the Loop Output editor.
- After the Stove Company header, use the Fields and Views button to insert your View of Stoves inside the Loop.
- Place the View of Stove Companies in a Page or some other template to display your nested list.

Let me know if you need more guidance or if you get stuck, and I can take a closer look.

#1450171
stove-template.png

Hi there,

Thanks for the reply. I have attached an image how I would like this to view.

I want each 'Stove Company' as a separate page with it's post relationship ('Stoves') listed underneath.

Hope this helps.

Thanks,
Jack

#1454641

To show each Stove Company in a separate page, you will create a Content Template for the Stove Company post type. Inside the Content Template for Stove Company, you can create or insert a new View of Stoves. Add a post relationship content filter to show only Stoves related to the current post. Let me know if you get stuck somewhere and I can offer assistance.