1

I currently have a custom post type setup for the different buildings that a Real Estate developer owns. Each building can have multiple images, a short description and a few different fields setup in a custom metabox.

I would like to allow my client to add available space listings for each property, and I'm stuck on the best way to integrate listings with the buildings. The available space listing would require a few fields including square footage, price and an image.

I've though about creating a listings taxonomy and even a custom post type for them, but the listings are really a 1-n relationship with the buildings, so neither is an ideal solution.

A custom metabox in the building post type seems like it would work, but it would somehow require a way to create multiple instances of the same metabox.

Does anyone have any ideas or suggestions?

1

2 Answers 2

1

I think perhaps an Available Space Custom Post Type, along with custom post metadata for the Available Space CPT, to correlate each Available Space CPT with its appropriate Building CPT, is the way to go here.

A one-to-one relationship would lend itself well to custom post metadata in the Building CPT itself, but the one-to-many relationship really implies that you should go the CPT route.

3
  • I've considered going the CPT route with the listings as well, but the many-to-many relation that would create would probably become cumbersome. Each available space listing is only directly related to a single building, so displaying them all together would get confusing when editing/deleting listings.
    – Dan
    Oct 5, 2011 at 18:23
  • Where would the many-to-many relationship come from, if each "Available Space" CPT had post custom metadata that tied it to a specific "Building" CPT? Oct 5, 2011 at 18:31
  • I was thinking it would be confusing on the administration side. I guess if I can sort the "Available Space" CPTs by a custom metakey, it might work.
    – Dan
    Oct 5, 2011 at 18:44
0

Similar to @Chips suggestion above, I would create a custom post type for "Available Space" with meta boxes for the space listing details.

However, I would create a custom taxonomy for the various "Building" types. The taxonomy would allow you to easily group or sort the "Available Space" posts by the "Building".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.