0

I'm building a plugin which features an custom post type Events. Now I would like to add functionality to support venues. I think a custom taxonomy could do, but I'm not so sure, because I would like to add lots of information to a venue (like images, url's, upcoming shows per venue, etc).

As far as I could think of I have three options:

  1. Custom taxonomy Venue
  2. Custom post type Venue, connecting it to Event somehow.
  3. Custom table venue, hardcoded in the DB

The last option seems a bit frightning. I would not like to mess around in the Wordpress database, only if I have to.

My requirements for the solution are:

  1. I should be able to create a list of events per venue.
  2. A venue should hold lots of information like addresses and stuff.
  3. I should be able to pick a venue from a dropdown while creating an event.

What's the way to go here? Remember, I'm not particularly asking for code, I like to write my own. The only thing I need is a hint or something like that to get me going.

2

Custom taxonomy should be ruled out if venue needs to hold lots of information. Which leaves you with custom post type or custom DB table, so:

Custom DB table would be the best option in performance point of view since it will only holds the needed fields and not all of the CPT fields (from the WP_posts table) and it will allow you to query a single database table instead of 2 (post meta).

But creating a custom table you loose all of the native functionality like admin UI, WP_Query ... which you will have to custom code from scratch. Now using a custom post type you can simply create a venue custom post type which will use the native admin UI and all Query functions you need. Add a few post meta fields (address and stuff). and all that is left for you to do is create a meta-box in the event CTP edit panel to select a venue for a list.

I would probably go with Custom post type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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