Skip Navigation

[Resolved] Archive View should show Titles from Many to Many realtionship

This support ticket is created 6 years, 4 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 2 replies, has 2 voices.

Last updated by Nigel 6 years, 4 months ago.

Assisted by: Nigel.

Author
Posts
#1085470
CorrectView-Themes.jpg
InCorrectView-Speaker.jpg

I have a set of CPT with special relations:
1. Lehrgänge (Trainings) - Many Lehrgänge can assigned to One Referent
2. Referenten (Speakers) - Many Referent can assigned to One Lehrgang
3. Themen (Theme) - the intermediary Post Type between 1 and 2. Themen have own Custom fields (like Vortragstitel -lecture titles)

Now i try to show in the Archive-View of Lehrgänge all Vortragstitle and all Speakers wich are assigned to the Lehrgang.

I create a view wich shows Content Type Themen and have Filter by post relationship or repeatable fields group owner wich selects posts in a Themen relationship that are related to the Post where this View is shown. These works correctly.

Also i create a view with shows Content Type Referenten and have Filter by post relationship or repeatable fields group owner wich selects posts in a Themen relationship that are related to the Post where this View is shown. But here i get only empty content. There are no Referenten shown.
I work with [wpv-post-title item="@thema.parent"]

Here the online-View of the archive.
hidden link

#1085691

Nigel
Supporter

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

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

Hi Thomas

Would you mind if I looked at this on your site, I'll be able to see the relationships more clearly and see if I can spot the problem.

What you describe sounds like a "simulated" many-to-many relationship, as was normal with Types 2 before real many-to-many relationships became possible with Types 3.

I'm guessing that you set this up with Types 2 and then migrated the relationships in Types 3, is that correct?

(As an aside you may like to know that the next major Types update in a week or two will include a merge facility to convert these "simulated" m2m relationships into real m2m relationships.)

Let me mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site, even though I don't intend to make any changes.

#1085775

Nigel
Supporter

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

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

Hi Thomas

I looked at your site, and the relationships I found didn't quite correspond to your description, let me describe it here:

   Orte
     \
      \
       \
    Lehrgrange      Referenten
           \          /
            \        /
             \      /
              Themen

I tried to look at the set up in closer detail, but when I edited the archive for Lehrgrange the template is made with Divi and I couldn't edit the Divi modules to see what they contained for some reason.

So, if I have understood what you want to do, on the archive for Lehrgrange, for each Lehrgrange post you want to list the linked Referenten.

If there were only one linked Referenten you wouldn't need a View for this.

When you insert a field in the Loop Output section of your archive you'll see a post selection tab to specify the source for the shortcode, and you can specify the related Referenten post (but it will just output one in this example).

If you have multiple related Referenten then, yes, you need a View which queries the intermediate post type, or Themen in your example.

Then in the Loop Output section of that View you can again use the Fields and Views button to insert fields and, when you do, you'll see the Post Selection tab, where you can specify that you want to output fields not from the current Themen post but from the related Referenten post.

In your description you talk about using two Views, but you should only need one.