4

Let's say i have a sample post called "avatar" in "movie", "trailer", "review" and "details" custom post types.

How can i display in the "movie" custom post type the content + links to "trailer", "review" and "details" custom post types ?

4 Answers 4

9

Ideally, you'd want to cast your vote into adding the infamous post2post relationship, which is still missing:

http://core.trac.wordpress.org/ticket/14513

In the meanwhile, the workarounds are three:

  1. Map your posts to specially crafted taxonomies. (slow)
  2. Store relationships in postmeta. (very slow if you ever need to use that in a join statement)
  3. Create your own post2post table.
3
  • Well defined choices. Of course you didn't mention that all three options are a lot of work if custom code is required, and the first has the potential to be very fragile. Commented Feb 10, 2011 at 15:33
  • 1
    I didn't say any of the three was a walk in the park, lol. ;-) Commented Feb 10, 2011 at 15:46
  • Are there any handy examples on how to create code using those 3 workarounds mentioned above? I'm trying to build a plugin that relates custom post types and am trying really hard to find a solution, given that I cannot use the Posts2Posts plugin within my own plugin.
    – urok93
    Commented Aug 9, 2012 at 16:00
2

Hi @m3tsys:

First, you might find this trac ticket instructive.

That said, the best solution I've found this far is ZigConnect Plugin:

Hope this help.

0

You can create relationships between custom post types with the plugin Sub Posts, price: $ 19.99. With this plugin you're done in minutes, from creating the relationships to displaying them in widgets or shortcodes.

0

Maybe I see this totally wrong, but is it not better to make just 1 custom post type with different fields ? Make a custom post type called movies with the fields review, trailer and details. It seems rather odd to sort for example details together of different movies. If it's the actors for example you want to sort them on, make that a separate field. That way, you can find all movies with a particular actor.

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.