Skip Navigation

[Résolu] Intermediary Post Field not showing, Content Template broken

This support ticket is created Il y a 1 année et 8 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Ce sujet contient 20 réponses, a 3 voix.

Dernière mise à jour par Minesh Il y a 1 année et 8 mois.

Assisté par: Minesh.

Auteur
Publications
#2570055
KI_Toolset-Pos-an-Klinik.png

Tell us what you are trying to do?
I created an Intermediary Post Field called "Position an der Klinik" and would like to show that in the frontend, e.g. here
lien caché
Unfortunately that seems to have broken my view, the output has errors ("Loading"):
Direktor der Klinik für Allgemein-, Viszeral- und Thoraxchirurgie und Leiter des DarmZentrumsLoading…
–>Leiter der Sektion ThoraxchirurgieLoading…
–>OberärztinLoading…
–>OberarztLoading…
–>Ltd. Oberärztin und stv. Klinikdirektorin, Koordinatorin des DarmZentrumsLoading…
–>OberarztLoading…
–>

Is there any documentation that you are following?
I tried to follow this, but somehow it is different on my page, the options are not available:
https://toolset.com/course-lesson/displaying-related-posts/#displaying-information-from-intermediary-post-types
https://toolset.com/forums/topic/displaying-intermediary-post-type-data/

Is there a similar example that we can see?

What is the link to your site?
lien caché

This is the link to the page I'm editing:
lien caché
You can use the login credentials from this Topic: https://toolset.com/forums/topic/connected-post-type-field-not-showing-in-view/ @Waqar

#2571427

Christopher Amirian
Supporter

Les langues: Anglais (English )

Hi there,

I suggest that you test two things and get back to us with the result:

1) Create the view in question in isolation.

What I mean is that you create a temporary page.
Create the View there and see if the data values show there correctly or not.
If no, then you will know the issue is the view itself and not the combination of the views inside the page you mentioned.
If yes, then go for the step 2.

2)Check for possible plugin and theme conflict.

- IMPORTANT STEP! Create a backup of your website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except Toolset and its add-ons.
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.

Kindly get back to us with the result of the tests above.

#2571851
2023-03-13__Toolset-Intermediary-Posttype-Information.png
2023-03-13__Toolset-Show-only-field-related-to-current-parent-frontend.png
2023-03-13__Toolset-Show-only-field-related-to-current-parent.png

Hi Christopher, I got it working again. Some Script changed the content of another "Fields and Text" field in my Content Template and that crashed all the subsequent templatecode.

Could you help me with a followup problem? I have a Doctor (CPT) which is associated with multiple Clinics (another CPT). An intermediary many-to-many posttype connects both. The Intermediary Posttype has a custom field "Position an der Klinik". How can I display only the "Position an der Klinik" of the current Clinic? At the moment it shows ALL entries of "Position an der Klinik". Please see the screenshots for a better understanding. I think I need another filter, but can't find the correct one.

Best regards
Harry

#2571983

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

It seems to me that you have added the correct filter but I'm not sure why it shows multiple items and for that I will require to review2 your current setup.

Can you please share problem URL and admin access details and let me check what's going wrong with your setup.

*** 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 have set the next reply to private which means only you and I have access to it.

#2572153

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

I can see with the following problem URL you shared:
- lien caché

The first doctor "Prof. Dr. med. Markus Rentsch" does display all the positions he holds.

I checked the same doctor's edit page:
=> lien caché

I see he holds the positions "Leiter des DarmZentrums Direktor der Klinik für Allgemein-, Viszeral- und Thoraxchirurgie" which is already displayed with the first post.

Do I misunderstood anything here?

#2572217

I want only the position displayed which is connected to the Klinik currently displayed. So on this page
lien caché
I only want to display
Direktor der Klinik für Allgemein-, Viszeral- und Thoraxchirurgie
and on this page
lien caché
I only want to display
Leiter des DarmZentrums

Hope that makes my problem clearer and you can follow?

#2572771

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

But based on what thing I will know that with the following post:
- lien caché

I've to display only related posts belongs to related post custom field "Position an der Klinik" value that is "Direktor der Klinik für Allgemein-, Viszeral- und Thoraxchirurgie" with the above post.

Or it's ok for you it should be hard-coded?

#2572777
2023-03-14__Toolset-Mitarbeiter-is-related-to-Klinik.png

The Klinik and the Mitarbeiter are related, so Toolset should know this automatically. Just look here:
lien caché

#2573679

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

I've created the following view - you can adjust the view's "loop output" as required:
=> lien caché

Where I've added the Query filters:

Filter by post relationship or repeatable fields group owner
Select posts in a Kliniken Mitarbeiter/innen relationship that are related to the Post where this View is shown.

and

Custom field filter
Select items with field:
Position an der Klinik is a string like VIEW_PARAM(position)

To the Edit page of "Darmzentrum":
=> lien caché

I've added the above view as given under using the Text module:

{!{wpv-view name='show-related-position-der-klinik-classic-view' position='[wpv-post-title]'}!}

On the frontend I can see the desired results:
- lien caché

You can replace the above view where ever you want to display such related posts.

#2574147
2023-03-16__Toolset-View-in-Content-Template.png

And how do I get this logic implemented here in this Content Template? It doesn't work when I build it there:
lien caché

#2574179

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

The thing is that when you use blocks, view inside another view is not supported in such a case.

But I wonder why you want to add that into that content template?

I see you are using multiple views there with multiple conditional statements. If you can tell me the reason I'm happy to guide you in the right direction.

#2574331

I don't quite understand, according to the documentation it is the recommended way to build stuff, or is it not? The old views are marked "legacy". And should I not use a Content Template? I also use it in other places, like here lien caché , so I think it's reasonable?

It's also written in the documentation that I have to use views. I would also rather like to simply insert custom fields, but that didn't work. Probably because of the nested views?

Should I try to build it into one view? But for a list of all "Kliniken" related to a "Mitarbeiter" I need to use a nested view, there is no other way as far as I know? See here: https://toolset.com/forums/topic/connected-post-type-field-not-showing-in-view/

#2574413

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

I don't quite understand, according to the documentation it is the recommended way to build stuff, or is it not? The old views are marked "legacy". And should I not use a Content Template? I also use it in other places, like here lien caché , so I think it's reasonable?
==>
The old views are classic views but still you can able to use it. Its not retired or put into the maintenance mode like Toolset Layouts plugin. For instance - Blocks GUI is sometimes limited like you can not use view inside views so in that case you can use classic views.

It's also written in the documentation that I have to use views. I would also rather like to simply insert custom fields, but that didn't work. Probably because of the nested views?
==>
yes - it could be.

Should I try to build it into one view? But for a list of all "Kliniken" related to a "Mitarbeiter" I need to use a nested view, there is no other way as far as I know? See here: https://toolset.com/forums/topic/connected-post-type-field-not-showing-in-view/
==>
Actually, it depends on your requirement what you want to display.

Like the solution I shared is with only one view. It does not require nested view and I show you how I implemented it and what "Query Filters" added to the view.
- https://toolset.com/forums/topic/intermediary-post-field-not-showing-content-template-broken/#post-2573679

But the reason why we still use the classic view even though it does not require nested view because we have to pass the current post title (its position name) and we compare that with the intermediary post type custom field "Position an der Klinik". Like I shared before:

{!{wpv-view name='show-related-position-der-klinik-classic-view' position='[wpv-post-title]'}!}

So classic views are more featured and powerful for such advance usage.

#2574973

I want to display alle "Mitarbeiter" and all their related fields from the many-to-many relationships. This is what I expect from Toolset and I don't understand why it is so difficult.

Why is there only one "Mitarbeiter" showing here when I use the classic view you built? There should be 6 Mitarbeiter:
lien caché

#2575103

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Ok - instead of digging too me here. What if you try to use the classic view I shared where I'm displaying now the position with the link. You can adjust the output of it from the View's Loop Editor:
=> lien caché

And add this view using the shortcode block or fields and text block or using content template that is not assigned to any post and add it to the view's loop that is displaying all six posts currently.

will that make sense?