Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I hope someone can help out with this as it is very frustrating...

I am trying to build a property site in Wordpress and would like to link two custom post types together -

One would be development areas and the other would be individual properties within that development area

I understand that I can create a CPT called 'Developments' and another called 'Properties' but how would I go about linking them together?.. for example if I created a property and tried to attach it to a development how would this work if they are separate custom post types?

I read a similar question - How to connect different CPTs together? and the answer by Scuba Kay was almost what I needed but I don't know how you would query a certain property which belongs to a certain Development

Thanks in advance!

share|improve this question

2 Answers 2

You can use the fantastic and free Advanced Custom Fields plugin, which allows you to create a Relationship custom field, that relates one post to another post.

Anyway, first of all you should make sure you really need two custom post types, and you cannot use taxonomies or just custom fields. For example, an individual Property may be a post type, and the Development Area they belong to, may be a Taxonomy or a Custom Field containing the name of that Development Area... It basically depends on how much information you need to keep about both Development Areas and Properties...

share|improve this answer

I would keep it simple and simply make the properties found within a development into child posts of the parent development post. You could also use the standard category taxonomy and mark each "sub" property as part of the larger development. You could just have to input these developments as categories in the taxonomy. This way you keep all the properties in one long and easy to manage list. You can include or exclude whatever you need when you call this list by using the depth parameter or the taxonomy.

share|improve this answer
    
Thanks for your help, how would I go about making the properties found within a development into child posts of the parent development post? –  Kieran May 5 at 21:50
    
First make the parent (development) page/post. Then add a new page and on the right hand side of the editor you should see a page attributes box and one of the fields is called Parent with a drop down box. Use that to select the development. That should do it! –  campatsky May 6 at 15:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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