Tell us what you are trying to do?
I have CPT Books and Authors. I have Relationship (called Portfolio), one to many (Author can be assigned to one Book, Infinite Books can be assigned to one Author). On CPT detail page with Book (for example here - hidden link) I would like have list all Books from the same Author too
Let me illustrate with an example from my own test site, which has a similar structure, with a Project << Tasks relationship.
The parallel to what you want to achieve (display other books by the same author when visiting a single book) is to display other tasks of the same project when looking at one project.
So you will need a View to display the child post type, i.e. books for you, tasks for me.
That needs a relationship Query Filter to specify the parent (book, or project). But we are going to have to pass what the parent is to the View, using a shortcode attribute. So your Query Filter should look like my screenshot.
See how we are going to use an attribute "wpvrelatedto" to pass the parent post ID.
So, when we come to insert the View into the template for the child posts (books, or tasks), we use the wpv-post-id shortcode to provide the ID of the parent (specified by the item attribute), like so:
If you are not sure of the format for the item attribute, use the Fields and Views button to insert the wpv-post-id shortcode and specify the relationship as the source.
I set my best after your instructions, but I propably missed something.
Now - all Books are listed in detail - hidden link - not only Books related with concrete Author. Screens from my settings are attached. Do I need another filter?
Yes - the slug is just "portfolio", you are right - I fixed it.
Now my code is:
[wpv-view name="other-books-in-book-detail" wpvrelatedto="[wpv-post-id item='@portfolio.parent']"]
[wpv-post-featured-image]
[wpv-post-title]
But still I see all books instead of book of one author :/
I´m not sure about view in view structure in this case and maybe template for this view is wrong?
I will 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.
I first noticed that where you had inserted the View in the Beaver template for books you had not included in the wpvrelatedto attribute, which would explain why books by all authors were showing.
Except when I updated that myself, I found it was always returning No results found.
I then tried simply hardcoding an author ID: you'll notice the page still includes the View inserted with wpvrelatedto="76", but that also returned No results found.
So something evidently is wrong.
Editing the post relationship Query Filter for that View, if you try to specify a particular post, there is something odd. The post type offered is only Books, but that doesn't make sense because the View is already displaying Books, so the post type offered should be Author, as you can see in the screenshot (which is how it should look).
So, I'm not sure what has gone wrong with the View, but something has.
Hence I created a new View to demonstrate how it should work, and it does.
You will find a View "Other books by the same author" which currently just outputs the book title, but the filtering is working, so I suggest you update it so that it outputs the book content in the format you require, and then delete the existing View.