Tell us what you are trying to do?
- I am trying to build a new custom job search database. I am redeveloping an old site at hidden link. I have a local development environment I'm working on. I have created custom post types for organizations, staffings (job listings), and states. Each are in a many-to-many relationship as staffings can belong to multiple organizations, each organization can have multiple staffings, each state can have multiple staffings, each staffing can be in multiple states, etc.
I am trying to build a view that replicates what is on hidden link. See hidden link for where I've run into problems. I've tried following https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/ directions.
I'm trying to display a list of organizations and the staffing lists that are in relationship with them. However, I only want to display organizations that have a staffing listing where the custom types end_date field is >= today. Then list those staffing listings in a unordered list beneath them.
When I try to put a filter on the main loop it doesn't give me an option for a query filter for the staffing posts that are in relationship with that organization.
Is there a way to do this?
Thank you.
-Jon
Dear Jon,
Yes, it is possible with a nested view.
In your case, I suggest move the "organizations" post information into the child "staffing lists" view, for example
1) Edit the parent "organizations" post view, edit the child "staffing lists" view shortcode, pass current "organizations" post ID as Views shortcode attribute "organizations_id", for example:
wpv-view name="child-view-name" organizations_id="[wpv-post-id]"]
2) Edit the child "staffing lists" view, in section "Loop Editor", within shortcode [wpv-items-found] ... [/wpv-items-found], display the parent "organizations" post, information, for example, you can get the "organizations" post ID like this:
[wpv-attribute name="organizations_id"]
Display the "organizations" post link like this:
[wpv-post-title id='[[wpv-attribute name="organizations_id"]']
More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-attribute