Skip Navigation

[Resolved] displaying related post fields in a view

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to display the related Posts on a Parent Post.
Solution:
To achieve this you will need the use of the classic editor for views. The classic view can be enable by going to Toolset -> Settings and scrolling to Editing Experience and selecting the 3rd option which gives you access to both the block and classic editor.

Here is the documentation on how to nest your views.
https://toolset.com/documentation/legacy-features/views-plugin/using-a-child-view-in-a-taxonomy-view-layout/

Now you will be doing a nested view based on 2 post views. Where you will add the Child view inside the Parent view and then add the Parent view to the respective page.

First you will create your child view in the classic editor and populate it with the relevant fields inside the Loop editor. The final step on the Product view requires that you add the Post Relationship Filter. To add the filter you will need to scroll to the query filter section. If you're not seeing this section scroll to the top of the page and on the top right you will see "Screen Options" From there you can enable the query filter section.

Then scroll to the section and click add a filter and just add the post relationship filter. See Screenshot

Ensure that you've selected "The current post in the loop"

Finally just add this view to the Parent view and it should display the related information.

This support ticket is created 4 years 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 8 replies, has 2 voices.

Last updated by jimmyS 4 years ago.

Assisted by: Shane.

Author
Posts
#2026359

Tell us what you are trying to do?

I want to create a page (or archive page) containing a view that loops through a custom post type (plant profiles) displaying some fields but also fields from the related products. I have set up a many-to-many relationship between plant profiles and products, but cannot seem to achieve this in a view.

The final result would be a row containing for example:

Plant profile image, name, soil type, light level; and the related product fields like product title; price, stock status.
It seems views-within-views is not supported but maybe there is a better way to do this?

What is the link to your site?
hidden link

#2026757

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2021-04-19 at 3.50.31 PM.png

Hi Jimmy,

Thank you for getting in touch.

Essentially if you have a view listing out Plants and you want to display the fields from a related Product then it would require nesting the views and this isn't possible to do with our Block editor for views.

To achieve this you will need the use of the classic editor for views. The classic view can be enable by going to Toolset -> Settings and scrolling to Editing Experience and selecting the 3rd option which gives you access to both the block and classic editor.

Here is the documentation on how to nest your views.
https://toolset.com/documentation/legacy-features/views-plugin/using-a-child-view-in-a-taxonomy-view-layout/

Now you will be doing a nested view based on 2 post views. Where you will add the Product view inside the Plant view and then add the Plant view to the respective page.

First you will create your product view in the classic editor and populate it with the relevant fields inside the Loop editor. The final step on the Product view requires that you add the Post Relationship Filter. To add the filter you will need to scroll to the query filter section. If you're not seeing this section scroll to the top of the page and on the top right you will see "Screen Options" From there you can enable the query filter section.

Then scroll to the section and click add a filter and just add the post relationship filter. See Screenshot

Ensure that you've selected "The current post in the loop"

Finally just add this view to the plant view and it should display the related information. If there are any issues please let me know.

Thanks,
Shane

#2029169

Hello Shane
Thank you so much for the detailed support. I have not been able open the classical editor. Please help with that. I have looked everywhere to see what I am missing, but despite doing this - Toolset -> Settings -> Editing Experience ->block and classic editor - I cant figure out how to open the classic editor when creating a view. Please help.

#2030043

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jimmy,

No Problem. I suspect it is a case where you are inside the classic editor however the content template is being created in the Gutenburg editor ?

Are you currently seeing the menu option Toolset -> Views on your backend ? Please let me know and provide a screenshot of what you are seeing.

Thanks,
Shane

#2030545

Hi Shane
No there is no vies menu item in backend.
I read around a bit and saw someone had the answer that we cant run toolset bocks and toolset vies at the same time?
Would it help if i gave you site access?
Thanks for assisting.

#2030991

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jimmy,

That is true, you cant run the Blocks plugin and the Views plugin at the same time because they are essentially the same plugins just with different names.

Yes please provide me with admin access so that I can see why you're not able to activate the views/blocks classic editor.

I've enabled the private fields for your next response.

Thanks,
Shane

#2031035

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2021-04-23 at 10.23.48 AM.png

Hi Jimmy,

The first issue I saw was that the classic editor was not enabled. See Screenshot.

Your setting was currently set to only show the Block Editor.

Also I've setup the page with the nested view.
hidden link

Finally here are the 2 views.
Parent View.
hidden link

Child view
hidden link

Please let me know if this helps.
Thanks,
Shane

#2031079

Thank you so much! I cant believe that is all it was, i must have checked that a dozen times and not seen it. Great service and support. Much appreciated.

#2031083

My issue is resolved now. Thank you!