I am creating a physician directory. It will consist of physicians and locations. What I would like to do is when I create a physician, at the bottom it lists all the locations with check boxes next to each on. I could check the box for each location that physician is associated with. Can I do this without creating the Third mediary custom post type?
It seems to me rather clunky to create Physicians, Locations, and then have to create another custom post type 'Physician and Location Joins' where I associate each physician with their locations, one at a time. Am I missing something?
So, ok, let me talk this out and you guys correct me where I am missing something. I have created two custom post types.
Physicians
Locations
For physicians, I have created a few custom fields.
Name
Title
Prefix
Suffix
For locations, I have created some custom fields also.
Address1
Address2
City
State
Zip
Phone
I have created a couple Physicians, and a couple locations
I have designated Locations to the CHILD of Physicians.
So now when I am editing a Physician, at the bottom, I have an area called "Fields Table" and it says 'Locations' like I expected it to
However, there are no Locations listed I can select. But there is the ability for me to ADD NEW LOCATION... But I need to be able to simple select from the locations that already exist.
What am I doing wrong?
I think I finally understand the parent/child thing and I see now that I would not want to make a physician a parent of a location. A location will need to have lots of physicians associated with it, not just one.
What I would love to be able to do is the edit a physician and be presented with a list of locations currently in the system, and I could select one or more of them and/or add a new location right there... Maybe that is the Holy Grail but that is the functionality I need.
Any thoughts?
I need to be able to query a Physician and get a list of locations.
I need to be able to query a Location and get a list of physicians...
Dear Steven,
With the functionality you expect from Locations I would recommend you to use a custom taxonomy instead. But you cant add custom fields to a taxonomy.
One solution could be to use the description field of each term in a taxonomy, and fill in the address there.
There are also other plugins that will allow you to add fields to a taxonomy:
http://wordpress.org/extend/plugins/taxonomy-meta/
Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Caridad
Well, hmmm... Yeah I need to be able to separate out Address1, Address2, City, State, Zip... I would need to be able to modify the results based on any of these fields...
So, to clarify, there is no way to have a one-to-many relationship between two custom post types?
Dear Steven,
Yes, there is. You mentioned it yourself, using an intermediary taxonomy or an intermediary custom post type:
https://toolset.com/faq/how-do-i-associate-one-child-with-several-parents-of-the-same-type/
Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Caridad
I have decided that taking Types and then using ZigConnect plugin to maintain the relationships provides we with exactly what I was looking for. Thank you for your help...
SteveD, this is exaclty what i'm trying to do, how did you get on with ZigConnect ? as i see its a little out of data does it work ok with wordpress 3.5 ?
stevenD: I just installed zigConnect, looks great in the admin, - do you have any tips for displaying those relationships Zigconnect created? . . thanks stevie
just to add i found this http://wordpress.org/extend/plugins/posts-to-posts/ seems to be updated and some extra features.. might give that a go.. did you see that before?