I have to say the backend is working perfectly. Where I am getting stuck is trying to figure out the ‘display’ function on the front end.
2 post types, movies, actors related together in backend
What would be simple function to display the actor that is ‘related’ to the book being displayed. I know how to display post type meta information already, but can’t seem to figure out how to display the post type meta information that is ‘related’ to the original post type.
also have 2 other quick questions.
1. How to assign an array of objects to a type.
— say there were multiple actors in the movie, and I want to display them all. yeah, I know, bad example but I think it gets the point across
2. How to assign an array of post types to another type.
— say I want to not only have actors type assigned to the movie, but directors as well.
most of the time, I am not simply going to display the actor name on the movie page, but also the actor’s picture and profile info.
I have no problem creating an actors post type, with the input for name, image, description.
Still trying to figure out how to display the meta array of information for each actor assigned to the movie on the front end.
It would be really great someday to see a generic movie theme with notations in the code so we all could follow along and learn how to do this.
While I have no need for a ‘movies’ setup, I believe it would cover all the bases for what most people are after, as you would have fields:
1. movie post type
— production date
— cover image
— gallery images
2. actors post type
— actors name
— actors image
— actors description
Obviously a lot more could be added, but this would give great ‘training’ on how to relate multiple post types, and how to display both single related meta fields and arrays of meta fields on the front end.
- The topic ‘[Plugin: Posts 2 Posts] function to display related posts on frontend?’ is closed to new replies.