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 functions.php file

8

This is probably more complicated than you think, I would look into using a framework:

  • http://wpgear.org/#meta-fields

If you want to write your own , here are some decent tutorials:

  • http://net.tutsplus.com/tutorials/wordpress/creating-custom-fields-for-attachments-in-wordpress/
  • http://sltaylor.co.uk/blog/control-your-own-wordpress-custom-fields/
  • http://thinkvitamin.com/code/create-your-first-wordpress-custom-post-type/

Leave a Comment