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