Skip Navigation

[Resolved] How to create a View for unusual set up

This support ticket is created 6 years, 9 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 7 replies, has 3 voices.

Last updated by Nigel 6 years, 8 months ago.

Assisted by: Nigel.

Author
Posts
#616187

Hello,

Not sure this is an unusual set up or not but I need to know how to make view for it.
First, terminology. Track means music track. Alias means alternate title for music track. Pitch means "pitching" the Alias to a client. Client is a production house.

Here's my set-up.
Track-Alias (parent-child, one to many)
Alias-Pitch-Client (parent-child-parent, many 2 many)

I need 2 different views but I'll focus on the "single" view for the track right now.
When viewing the track is it possible to see, basically all the data at once:
VIEW
1. All the track fields (easy and obvious)
2. Also see the Alias titles attached to track (also easy)
3. The clients related to the Aliases.
4. The Pitch fields

Is it possible to see this all in one view?

Thank you!!
Regards,
Scott.

#616263

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Scott

To visualise this more easily, here are your CPT relationships:

Track
   \
  Alias    Client
     \     /
      Pitch

So, when viewing a single Track

- You need a View that queries Aliases that are children of the current Track to be able to show Alias fields
- You need a nested View that queries child Pitches for the current Alias.

In the output section of that View you can display fields of the Pitch directly, and you can display fields from the Client by using the id="$client" attribute in the shortcodes to set the context to the parent Client post.

So a minimum of two Views.

#616519

Thank you Nigel!
I thought I got it but it's not working for me. I get "no items found"

View 1: I named it "View Track Alias Relationship"
In Content Selection: I choose "Alias"
In the Query Filter I choose "Select posts that are children of the Post where this View is shown."
In the "Templates for this View" I put the fields I want from "alias".

(If I use this View as it is in the Content Template for "Tracks" all is good so far - I see the Aliases attached to the tracks and the Alias field I want.)

Now...

View 2: I called "View Alias Pitch relationship"
In Content Selection: I choose "Pitch"
In the Query Filter I choose "Select posts that are children of the Post where this View is shown."
In the "Templates for this View" I put the fields I want from "pitches" plus any fields i want from "Client" by using id="$client" ([wpv-post-link id="$client"].

Then I "nest" View 2 in View 1 by inserting it into the "Templates for this View" section of View 1, correct? (not really sure where the nesting takes place)

Then I put View 1 into my content template for tracks and I should see all the data.

So, what am I doing wrong?

Thank you so much for all your great help!
Best,
Scott.

#616713

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Nigel is on vacation today. This is Minesh here and I'll try to help you further.

Could you please share problem URL where you added the views you are using.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#617419

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Scott

You mean it is the second View that is displaying no results found?

Try changing the post relationship filter for that View to "Select posts that are a children of the current post in the loop."

So it will look for posts that are child posts of the current loop item of the outer View.

Assuming that such posts exist, they should be found using this filter.

When you nest Views the inner View needs to occur somewhere inside the wpv-loop tags of the outer View. If you combine your fields of the outer View into a content template then, yes, you can include the inner View there.

#618898

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Scott

This is sitting in my queue so let me mark it as waiting to hear from you while you set up your new environment.

#619163

Sounds good!
Thank you!

#622850

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Let me mark this as waiting to hear from you again, and this time no need to reply until you have something to report 😉