How to Add Custom Fields to a Custom Post Type?
Ok, so I have registered a few custom post types and a few taxonomies. Now, for the life of me, I cannot figure out the code I need to add a Custom Field to my Custom Post Type.
I need a drop down and a single line text area. But I also need to have separate fields for post types. So, say post type one has 3 fields and post type 2 has 4 fields but the fields are different.
Any tips would help I have looked at the codex and found something but cannot make sense of what I need to add to my
This is probably more complicated than you think, I would look into using a framework:
If you want to write your own , here are some decent tutorials:
really it would be that hard. I thought it would be as simple as adding a register code to my functions like we do with post types and taxonomies.
I'll plus one this answer, but it's not too complex. The thinkvitamin.com link does a great job explaining how to add the metaboxes and save them. The sltaylor.co.uk link is an awesome tutorial on using some great coding practices. My word of caution is be careful when using the `save_post` hook. It's called at weird times. Make sure to have WP_DEBUG variable set to true in order to see potential errors that arise when using it.