I'm building a job board site:
There are three custom post types: Company info, Job location, Job description.
With a many to many relationship, I was able to get Job location and Job description work well. I would like to add in Company info as well. I believe it's called many to many with intermediary.
I see examples in your videos but no tutorials as to how to make that happen.
The end product job listing would be:
Company info (name and description)
Job location (where is the job located)
Job description (what's the job and pay etc.)
I will then set it up to be searchable by location and job description.
Please let me know how I can do this.
hidden link
Hello, the normal workflow for creating a Many-to-Many (M2M) relationship with Intermediary post type is as follows:
- In Toolset > Post Types, create the two non-intermediary custom post types (in your case, it sounds like these are Job Location and Job Description). The intermediary post type will be created automatically by the post relationship process. There is not an easy way to incorporate an existing post type as an intermediary in an M2M relationship, a new post type must be created by the system.
- Go to Toolset > Relationships and create a M2M relationship between these two post types using the relationship wizard
- In the Relationship Fields step of the wizard, add any custom fields you want to appear in the intermediary post type (rel-fields.png)
- In the Names step of the wizard, you can supply a custom post type name and slug. You should check the checkbox to make the intermediary type visible in the WordPress admin menu (names.png)
- Now when you relate a single Job Location and a single Job Description in the Post Relationship editor panel of either post, you will have the ability to edit the custom fields you created for this Intermediary post type. You also have that ability in the post type editor for the intermediary post type, where you can also select the two parent posts.
To create a View of the custom intermediary post type filterable by both related post types, you would create a new View, select the intermediary post type for the content selection, and then add a post relationship filter. You can add both related post types as ancestors (filters.png). In this case, the filters are dependent upon one another, where the "child" side of the M2M relationship must be selected first.
Note that custom field filters in a custom search View can only filter upon fields contained in the post type that is selected in Content Selection. So if your search View's content type is the intermediary post type, it is not possible to also filter by custom fields in the Job Location or Job Description post types. Keep this in mind when structuring your data.
Ok, I see after I define the custom post type in the relationship editor and add fields I see it in the Post Relationship editor. Each time I make a connection between Job location and Job description I will have to fill out the Company Details. It doens not look like it saves this information. So that may not work well.
So, can I pull the company information in when building the view. We will only have one company however the info about that company(custom fields in the post) may change over time. We are trying to reduce the amount of editing.
We will only have one company however the info about that company(custom fields in the post) may change over time.
Let me make sure I understand. It sounds like you're saying there will only be one Company post, with multiple Job Locations and Job Descriptions posts connected to the same Company. Is that correct? If so, then I have misunderstood what you want to accomplish. What exactly would you be searching for when you described searching by location and description? If there will only ever be one company, then the results of the Company search will always be the one Company. So I think I am confused about what you want to accomplish. Can you provide more details for me about the search feature?