[Résolu] Post relationship panel is showing the wrong select menu for one of the parents
This support ticket is created Il y a 6 années et 9 mois. 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I have two parent post types: Projects and Landing-Pages
I have set up a post-type call Related projects and I have set both Project and Landing Page as the parent post types. I'm pretty sure I've got the parent-child setting correct (see settings.jpg)
When I go to the edit page for a landing page post type it all looks good (see landing-related-projects.jpg) with a dropdown to select a project appearing next to each row.
However, on the edit projects page the select menu for "landing page" is appearing instead of a select listing all the projects. (project-related-projects.jpg).
Actually it is correct. Parent CPT will allow you to create a Child Post from their Edit screen and given that Both Projects and Landing Pages are parent CPT for Related Project then this is how they will display.
If you check Related Projects you notice that it displays differently sso everything is actually correctly displayed.
OK but why are the post relationship options different for both the parent CPTs - see images I attached.
The in the post relationship panel on the edit screen for Landing Pages you'll see a dropdown with a list of projects - which is correct.
The in the post relationship panel on the edit screen for Project you'll see a dropdown with a list of Landing pages - this isn't what I want. I need to be able to choose a project NOT a landing page - why is it showing a select menu with the other parent CPT?
If you click to edit the related project you are presented with the correct projects dropdown on the edit screen for related projects - so why isn't this dropdown shown on the post relationship panel on the edit screen for Project ?
I've attached the screenshot of the problem panel again.
So in your screenshot it is from the Projects CPT on the Related Projects CPT. You are seeing the landing page select dropdown because this is the Parent select dropdown for the Landing pages that are created from the Project.
If you create a Related Project from a Parent Project post that related project will automatically have that project as a parent but since it is a 2 way parent then the Parent selection for Landing pages will show up as well.
Please let me know if this clears things up for you.
Thanks,
Shane
Yes, I understand that. But why do different options for the related project CPT in the list view (at the bottom of the edit project page) and the edit related project view?
The former shows a "landing pages" select box (which isn't what I want), and the latter provides a select menu for projects (which is all I want).
If I've set this up incorrectly how do I achieve the above?
It may be that I've just not understood how to set all this up.
But what I was hoping to achieve was to have a "related" projects panel at the bottom of both the edit projects page and the edit landing page screen where I can create a related project by choosing from a dropdown that contains all the related projects.
On the landing page edit screen this works fine - however on the edit project screen the panel for related projects is only showing me a dropdown for "landing pages" and I need to see a dropdown containing all the "projects" - it's related projects I need to set. (see project-related-projects2.jpg).
If I click to edit of the related projects I can see both a dropdown for landing pages AND projects.
That is because if you create a Related project From a project you won't get the dropdowns to select a project. That is because that project will automatically become the parent, now you are presented with the option to select the landing page because this is not automatically assigned.
If you were to create a related project from a landing page then you will get the project parent dropdowns to select a project.
Please let me know if this clears things up for you. In no scenario will you get Both Landing page and Project unless you create a related project from the related project tab.
At the bottom of BOTH the edit screens for landing page CPT and the Projects CPT there should be the ability to select multiple projects by using a dropdown menu to select each.
I know how to achieve this for a single Types custom field by using a select menu then adding a custom function to populate that menu with a list of the custom post types - but I can't make this method into a repeatable block - which is what I need.
I'm aware there's other ways I could achieve this - e.g asking the wordpress admin user to manually type in either the Titles, slugs or IDs of the related posts but that's just not very user friendly, and would involve them going off and finding the the ID of the posts they want.
To be honest this is a shortcoming I've often found when using the Types plugin which in all other respects I've found to be a very powerful and efficient tool.
From what you are saying I gather that you want to setup a many to many relationships where you can assign multiple Projects and Multiple Landing Pages. In this case I would recommend that you take a look at the link below.
Yes I've read that page, and that helped me set up the system that I currently have in place - but it isn't what I want to achieve. Please can you look at my previous post to see what it is I'm trying to do and explain how/if that is possible.
I took another look at your previous post and what you are asking is actually not possible 🙁 the only way to do the many to many relationships is through the method that you currently have . You are a not able to do in the way you define it in the previous post.
Thanks,
Shane
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.