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 am building a movie database site and I am wondering in a problem and asking how should I solve this problem.

I have several custom post types movie, actor, person and others. I want to integrate award feature for movies and actors. So I'll be able to assign awards to a movie. Now, when I am assigning an award to a movie, there are several fields:

  • Award Name (e.g: oskar, mtv movie award, etc)
  • Year (which year the award was given)
  • Category (which category, e.g: Best Actor, Best song etc)
  • Receipents (which actors, person (custom post type) won the prize )

So, I should be able to browse to a movie and see the award info (example). If I go to a particular award, I should be able to see the awards by year. If I go to a actor or person profile, I should be able to see which awards they got in which year.

Now help to structure the custom post type / custom taxonomy assignments. How should I assign the awards?

share|improve this question
    
will each award only be attached to 1 movie? What kind of relationship do they have? 1 to many? 1 to 1? many to many? –  Tom J Nowell Jan 18 '13 at 12:42
    
By the nature of awards, lets say "oscar", one award might be attached to many movies (won|nominattion) right? –  Tareq Jan 18 '13 at 13:38
add comment

3 Answers

up vote 0 down vote accepted

Have a nomination post type.

So your awards post type doesn't represent an award, it represents the 'nomination' of an award, a record that it was won or lost by someone/something. You then define the attributes such as the year, the type of award, its classification etc using taxonomy terms.

To assign it to a movie, set the movie post as the parent post for the award_won post. You'll need to write a metabox to handle this part yourself. To get a list of awards a movie has won, do a post query to find child posts of type award_won.

This will let you refer to the winning of individual awards, list all awards of a type, all the awards a movie won, all the people who won a type of award, all the awards allotted in a given year etc etc, and all the data has an associated listing.

You could do the same thing with actors and directors

Alternatively, if you need to track a movie loosing, you could call the post_type nomination, and have a taxonomy with lost and won as the terms. You can then set up using pre_get_posts to make sure that unless specified, only nominations in the won term are listed.

The only situation this would fail is when an award is given to multiple movies/people at the same time. For example, say an award was given for best onscreen relationship, and the recipient was 2 people, you would have an issue.

So to sum up:

  • A nomination post type
  • An awards taxonomy
  • A award_year taxonomy
  • Nominations parent post is the actor or movie that was nominated

You can add additional taxonomies, such as the award type e.g. 'oscar' 'grammy' 'golden globe', and award events 'MTV Music Awards NYC', 'MTV Europe Music Awards Berlin' etc

share|improve this answer
    
The posts-to-posts plugin covers all the functionality specified by you as well as you can relate 1-1, 1-M, M-1, M-M mappings for each post. –  Rohit Pande Jan 18 '13 at 12:54
1  
But it doesn't give him the listings, it requires an additional plugin, and it requires learning brand new APIs. My solution allows him to define everything he wants using just taxonomies and a custom post type, and every single attribute can have listings generated by WordPress straight out of the box with no effort, that he can then style using standard APIs & UI, with no additional tables, or overhead –  Tom J Nowell Jan 18 '13 at 13:02
    
@TomJNowell I agree with this point concerning P2P plugin, the need to have an additional API layered upon what's already available to us. I faced the same problem, I first wanted to create a solution that could be reasonably managed with the existing structure of the WP API before adding another mechanism (P2P) on top because it can actually add an extra layer of confusion. Data portability/flexibility is important to me which is why I still store (what some might call a waste of space) duplicate information in post meta that's already held in taxonomies in-case I want re-structure. –  userabuser Jan 18 '13 at 13:08
    
@TomJNowell, your suggestion is very close to what I want. So here's what I am deciding to do. I am gonna create a nominations post type with taxonomies: award(academy|grammy|bafta etc), year, type(won|nominated), category(best actor|director). Using post-to-post plugin, I'll create a nomination post (e.g: oscar-2012-harry-potter) with adding actor, person and will assign category , year, type etc. So every nomination is categorized, have year and have peoples attached to them. Then using post-to-post, I'll attach the nomination to the movie. It sounds best to me. –  Tareq Jan 18 '13 at 14:33
    
it sounds over-complicated, why don't you just use multiple nomination posts? After all Twilights nomination for best romance film, is not the same as casablancas nomination for best romance film. Same award and ceremony yes, but not the same nomination, and they should be separate posts ( what if the twilight nomination was controversial? Your scheme wouldn't be able to fit it in, and requires a 3rd party plugin to implement ) –  Tom J Nowell Jan 18 '13 at 15:39
show 1 more comment

Create award as a custom post type having the different fields as specified by you.

Try using advanced-custom-fields plugin for creating your own custom fields.

You can find the documentation here.

After creating the custom post type you can use posts-to-posts plugin for defining the relations in your posts.

You can go for the documentation here.

share|improve this answer
    
I am already using posts-to-posts and meta-box plugin heavily. But this award thing is kinda complicated :) . See my comment on @Tom J Nowell's answer. –  Tareq Jan 18 '13 at 14:38
add comment

Good question because I have also built a movie (also TV show) database that has exactly the same type of meta information as you have described and a few more.

What I did was to create a custom post type named "Awards" but I also created a hierarchical taxonomy called "Award" which can then hold the type of individual award categories associated with the Award Event itself.

I also have a taxonomy for "Year" but its non-hierarchical.

The reason for creating the Award post type was that I wanted to also create specific information for the award event, such as the history of the award so when a visitor clicks on an award, the top of the page has a content box containing a brief history of the event then followed by the awards listed descending order (by year).

I also use the Post 2 Posts plugin to create associations between the posts (actors-to-movies and movies-to-actors etc) however I did not begin my process with this plugin, I added it later in the piece.

Currently there is some duplication data as I also store some of the same information held in the taxonomies mentioned, in post meta fields because initially I was unsure of how I wanted to structure my setup. Its still a work in progress but for now I am satisfied that an,

  • Awards Custom Post Type
  • Award Custom Taxonomy (hierarchical)
  • Award Year (non-hierarchical)

...is a sufficient way to make these associations between actor, movie and award.

share|improve this answer
    
I am heavily using post-to-posts plugin too and also meta-box. I am thinking of using this solution wordpress.stackexchange.com/questions/82139/… –  Tareq Jan 18 '13 at 14:36
add comment

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.