Skip Navigation

[Resolved] view inside view loses subview details

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

Problem: I have a View of custom post types that I would like to display in different areas, where the filter is variable based on the location of the View.

Solution: Use a shortcode attribute to configure a dynamic View filter.

Relevant Documentation: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

This support ticket is created 6 years, 6 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 6 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#958664
test-event-post.png
event-view.png
single-event-using-event-view.png
wod-view.png
single-wod-using-wod-view.png
relationships.png
test-wod-post.png

Tell us what you are trying to do?
I have a view that displays an instance of a "wod" post type. This "wod" post type is composed of a) a "workout type" post type and b) several "movement" post types. I am able to get a view for this to display what I want beautifully on a "wod" post (see single-wod-using-wod-view.png)

Now, any given "wod" post, needs to be able to be tied to one or more "event" posts. I can't figure out how to get the wod-view (as it displays for the "wod" post) to also display on a given "event" post. (see single-event-using-event-view.png)

I'm sure its just something I'm not doing right.

Just for clarification:
--> wod = workout of the day
--> movement = a given exercise (a wod consists of many exercises and an exercise can be included in many wods)
--> event = a particular exercise class (same wod can be used for many classes, but any given class only uses one wod)

*** SO ultimately for a given class I want to show all the WOD details that are associated with that specific class (including all exercises and instance fields).
-----------
Is there any documentation that you are following?
I've read so many pages, I think I've confused myself. I was looking at what was available on: https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/#adding-a-view-to-a-view

-----------
Is there a similar example that we can see?
I can get the desired "wod" post title displayed. But none of the content for that "wod" post.

-----------
What is the link to your site?
Currently not on a public server.

#983165

Hi, I would probably move the wod-view shortcode out of the post body of each WOD post, and place it in the Loop of the Events View instead of using a post content shortcode there. Then I would check the Query Filter of the wod-view and configure it to respond to a shortcode attribute. This will allow you greater flexibility to show this View in other places, like on a single Event post, nested inside a View of WODs.

Basically this will allow you to pass a WOD ID into the filter dynamically, something like this:

[wpv-view name="wod-view" id="[wpv-post-id]"] 

The wpv-post-id shortcode will pass in the WOD ID within the current context. This technique is called "passing arguments into Views" and is explained in more detail here: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

If you want to display the wod-view on the single WOD post, add it to the single WOD Content Template or Template Layout.

Also, in the Event View, I can see you have the "Don't include the current page in query results" checkbox checked. I recommend you uncheck this checkbox unless you plan to display this View on a WOD post. The only time I recommend using this checkbox is when a View shows post type "A" and is also displayed on post type "A". Otherwise it can cause unexpected issues with post relationship filters.

Please let me know if I've misunderstood the issue and I'll take a closer look.

#1070324

Thanks for your response. I'll try it out. But leaving on vacation so may be a week before I can post whether this fixed my problem. I'm sure it will.

#1071469

Great, let me know when you return if the problem is not resolved.