Support » Fixing WordPress » Custom post types hierarchy Child a different post type than Parent

  • I’m wondering if it’s possible in wordpress to have a child be a different custom post type than a parent.

    For example:

    Parent:Post Type A
    Child:Post Type B
    Child of Child: Post type C
    and so on

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • From some research it looks like this is not possible.

    seems like my options are the following:

    1.Custom table in the database which will add the relationships

    2.Custom post type with all of the info needed. At the top end some fields will be left blank and not displayed.

    If anyone has other ideas, or experience with this, let me know

    Not quiet sure what u want to achieve with it, might tell us that so we can give some hints for your setup?

    the basic structure of the data i would like to have is
    region -> state -> city -> street -> address (marker)

    The website will be user driven.. Users will be allowed to create cities in states, streets in cities, and markers on streets.

    This way users can go to Region 1 -> State 1 -> Add City

    or Region 1 -> State 3 -> City 5 -> Add Street

    When the user creates a Marker, they will always be coming from a street page, and the marker will always be a child of that street. Street will always be a child of the city, and up the list.

    Hope this is clear enough

    To explain my thoughts on how to do this I could have custom post types:

    Region, State, City, Street, and Marker and a table in the database:
    ID: Rel_ID
    Parent: Post ID
    Child: Post ID

    When the user creates a Street, it will create a custom post: Street, and add the ID to the Child ID. It will also find the ID of the city they are in, and add that to the parent ID.

    Otherwise I could create one massive Custom Post with the following values:
    Region:
    State:
    City:
    Street:
    Marker:
    whatever other content needed:

    For my regions, I would have to only populate the “Region” field. For States I could populate Region and State… or only have field for the user to enter the state… this is quite obviously not the way to do it… but would be faster to get running

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom post types hierarchy Child a different post type than Parent’ is closed to new replies.