Views is a WordPress plugin that lets you display post relationships.
In our user guides, you can find more information on how to display child posts, related posts, brother pages, fields of parents and fields of grandparents.
When you ask for help or report issues, make sure to tell us the type of the relationship you are trying to build and the structure of your data.
Problem: I have a nested View structure that shows parent posts in the outer View and child posts in the nested View. In some cases the parent post has no child posts, and I would like to hide those parent posts in the results. The problem is that the nested child post View is filtered. Is there a conditional that tests whether or not a parent post contains these filtered child posts?
Solution: You can solve this without custom code by restructuring the Views. Instead of displaying the parent post information in the outer View, display the parent post information in the nested child View, inside wpv-items-found but outside wpv-loop. Use the item attribute to display parent post information with any shortcodes in the nested View, since the post context in the nested View is the context of the child posts. The syntax for the item attribute is item="@relationship-slug.parent" in a typical one-to-many (O2M) relationship.
Problem: I have 3 custom post types. A is related with B, and A is related with C. I have a view with C information and i want to show also B info that are related to A.
Solution: Depending on the types of post relationships, you may also need a View of post type A.
- If A-C is a one-to-many (O2M) relationship and "A" is the parent, you do not need a View of A in this case.
- If A-C is a O2M relationship and "A" is the child, there can be multiple A's related to each C, so you need a View of A.
- If A-C is a M2M relationship, there can be multiple A's related to each C, so you need a View of A, regardless of which is the parent and which is the child.