Skip Navigation

[Resolved] Looping through child post type records on the parent page

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 3 replies, has 2 voices.

Last updated by Christopher Amirian 1 year, 8 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2570221

Tell us what you are trying to do?
I have created two custom post types Course Categories and Courses. They are linked by a 1 to many relationship, which I have defined in Toolset.
I have a single page template for Course Categories, and want to list out the courses in this category on the same page. I don't see Views in the Toolset menu, which I think I have used in the past. What's the correct way to do this using the latest version of the pluguins?

Is there any documentation that you are following?
I have looked, but can't find the right help to follow.

Is there a similar example that we can see?
No

What is the link to your site?
hidden link
This page is dynamically built with Toolset custom fields. At the bottom, in bold, you can see where I want to insert a list of all Courses for this Course Category (in this case, courses in the Business Skills category, but the template must work automatically for the other Course Categories too).

Thanks in anticipation 🙂 !

#2571391

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

It is not possible to have nested views using the block editor. To do that you will need to enable the legacy views mode:

- Go to "Toolset > Settings > General".
- Find the "Editing experience" section.
- Check the "Show both the legacy and Blocks interface and let me choose which to use for each item I build" checkbox.
- Reload the browser page.
- Go to the newly added "Toolset > Views" menu.
- There you will be able to edit the views.

For more information:
https://toolset.com/course-lesson/enabling-legacy-version-of-toolset-views/

Then you can use the method below:

https://toolset.com/forums/topic/displaying-nested-views/#post-1582405

I also suggest that you change your structure as the post-relationship is not for the categories.

Instead, it is better that you create a texonomy for the Courses post type and call it Courses category. That seems to be more logical way to do so.

If you want to have custom fields for that taxonomy you can go to Toolset > Custom Fields and select the Term Field tab to add fields for the taxonomy.

Thanks.

#2573339

Hi Christopher,

Thanks for the reply. So I have moved on and worked out how to do what I want, which is to add a View in the content template and say that it is for a child post type in the relationship.

I did contemplate the built-in WordPress Category route, but my Course Categories need to be a fully-blown CPT, don't they, as it needs custom fields, like text and video etc. I can't see that custom fields can be added to built-in WordPress categories - or am I missing something?

Finally, your suggestion that Views are editable from the Views menu once legacy mode is turned on for blocks doesn't seem right, as if you try and edit a View there, it simply puts you back in the Content Template to edit it there! The only usefulness, it would seem, of exposing the legacy Views option, is if you want to delete a View, as there's no other way to do that from what I have read.

Best wishes,

Steve

#2573539

Christopher Amirian
Supporter

Languages: English (English )

Hi Steve,

I did contemplate the built-in WordPress Category route, but my Course Categories need to be a fully-blown CPT, don't they, as it needs custom fields, like text and video etc. I can't see that custom fields can be added to built-in WordPress categories - or am I missing something?

Actually, it is possible. As I mentioned you can create a separate Taxonomy using Toolset and call it Course Category (not the default WordPress one) for more information:

https://toolset.com/course-lesson/creating-a-custom-taxonomy/

Then you can use the method below to assign custom fields to that course category:

https://toolset.com/documentation/term-fields/

Finally, your suggestion that Views are editable from the Views menu once legacy mode is turned on for blocks doesn't seem right, as if you try and edit a View there, it simply puts you back in the Content Template to edit it there! The only usefulness, it would seem, of exposing the legacy Views option, is if you want to delete a View, as there's no other way to do that from what I have read.

If you use block editor to create a view it will show in block editor anyways. To be able to use the legacy mode you need to go to Toolset > Views and add a new view, there you will see that the legacy view will show you.

Here is the documentation:

https://toolset.com/documentation/legacy-features/views-plugin/

Thanks.