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