Skip Navigation

[Resolved] Listing all "Authors" connected via a Many-to-Many relationship

This support ticket is created 4 years, 10 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
- 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)

This topic contains 6 replies, has 2 voices.

Last updated by peterv-5 4 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1587599
Screen Shot 2020-04-15 at 3.41.52 PM.png

I have a Many-to-Many relationship; Many "AHHA Authors" can be connected to "Spiritual Book", and vice-versa.
When I list all "Spiritual Books" I want to list the MANY authors connected to it.

I'm using:

[types field='author-first-name' item='@spiritual-book-ahha-author.child'][/types]

to get and list the first author, but how do I loop through to list all authors?

Here:
hidden link
you can see that I've listed "Cinthia McFeature, PhD"
But how do I loop through to show the others?

The image attached shows that I have 2 authors connected to this book
hidden link

#1587931

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

To display related posts of many to many relationships, you need to create a view to display the related posts which are in many-to-many relationship.

Please check the following Doc:
=> https://toolset.com/documentation/post-relationships/how-to-set-up-post-relationships-using-toolset/#relationship-fields-in-many-to-many-relations

This is how you can display the related posts with many-to-many relationship:
=> https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-information-from-intermediary-post-types

Please let me know if you need further assistance on your issue.

#1588979

I'll use "Blocks" if I must. But I currently don't use them and had not plan to.

So, MUST I use "Blocks" to achieve this?

But the larger question is:

Are there things, either now, or planned for later by ToolSet, that will require me to use Blocks?
Or will everything be available either with: with or without Blocks?

Thanks!

#1588997
ForToolSet.png

I looked ever the documentation sent, and it looks like what I've already set up WITHOUT using blocks.

More importantly, it looks like this will only display ONE item.

The instructions clearly state "A post related to current post" - not "MULTIPLE posts related to the current post".

I am already able to display ONE post related to the current post but need to display ALL of them.

Here is a page that displays the ONE author:
hidden link

And attached is the screen shot showing that there are multiple authors attached to this same post.

Thanks.

#1589337

Minesh
Supporter

Languages: English (English )

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

Can you please send me temporary admin access details so I can check whats going wrong with your site.

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

#1592297

Minesh
Supporter

Languages: English (English )

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

To display the related Authors of your many-to-many relationship I've created the following view:
=> hidden link

Where I've added the Query filter:

 Filter by post relationship or repeatable fields group owner
Select posts in a Spiritual Books AHHA Authors relationship that are related to the Post where this View is shown.

And added the fields to Loop Editor as given under:

<wpv-loop>
          <li> [types field='author-first-name'][/types] [types field='author-last-name'][/types], [types field='author-initials'][/types]  </li>
		</wpv-loop>

I can see not it displays all the related Author information:
=> hidden link

More info:
=> This is how you can display the related posts with many-to-many relationship:
=> https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/

#1593201

Following your example, I made my own "sub view" to be displayed INSIDE the larger loop, so they can display on the search page as well.

hidden link

Thanks!