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.

Maybe I'm not getting the whole concept, but is there a way to modify a Custom Post Type so that it includes other 'fields' like a 'real' db table. I don't mean a Custom Field (get_meta)... I mean inside the table that can be manipulated with rules. I want to make a post type with several -mandatory- fields.

eg.

Song Record:
 <Title
 <Lyrics
 <Date
 <Length
 <MP3
 :end

Yeah, I can do that with a bunch of custom fields, but I was wondering/hoping if this structure could all be laid out with Register_Post_Type so it could be manipulated as a single 'object'... as one can do in Drupal.

Or have I got this all wrong?

---JC

share|improve this question

2 Answers 2

up vote 0 down vote accepted

There is no built in way to do so. You could possibly do it via MySQL directly via ALTER TABLE but you'd have to write custom code to take advantage of this yourself. Another option is to create a new table where each set of data references a certain post. Yet again, you'd have to manage everything yourself.

My suggestion: use a plugin like Meta Box or WP Alchemy to use the custom field system that's already there. Either one creates a meta box of fields that'll save the custom post meta for you

share|improve this answer
    
Thanks. I'm one of those guys who is comfy with SQL and sometimes I find WordPress -annoying- with all the requisite calls to meta fields. Just feels messy. I think I have another way to skin this cat but it's really a separate question. Cheers. ---JC –  jchwebdev Feb 27 '13 at 22:26

I don't understand what you mean by "manipulated as a single object." Custom Fields are part of the post and as such can be manipulated anyway you like.

If you want to make a post type with mandatory fields and need an very easy way to do it, take a look at the Advanced Custom Fields plugin. You can set conditions on when and where fields appear and there are a bunch of different field types. Another plus is the great support that the developer offers.

You can find it here http://advancedcustomfields.com

share|improve this answer

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.