Hello,
I am trying to understand adding custom posttypes and meta box. I understand the custom posttypes but I can't figure out the meta box. I hope somebody can help me with an example.
I have the custom post type: Recipes
register_post_type('recipe', array( 'label' => 'Recipes','description' => 'Add a recipe','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => ''),'query_var' => true,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'labels' => array (
'name' => 'Recipes',
'singular_name' => 'Recipe',
'menu_name' => 'Recipes',
'add_new' => 'Add Recipe',
'add_new_item' => 'Add New Recipe',
'edit' => 'Edit',
'edit_item' => 'Edit Recipe',
'new_item' => 'New Recipe',
'view' => 'View Recipe',
'view_item' => 'View Recipe',
'search_items' => 'Search Recipes',
'not_found' => 'No Recipes Found',
'not_found_in_trash' => 'No Recipes Found in Trash',
'parent' => 'Parent Recipe',
),) );
I can add this code to the function.php and there is my custom post type. Now I want to add a meta box. For example cooking time. And now I get stuck. Can somebody help me with this meta box? So I can view it and than make my own meta boxes! :)
I know there are plugins for this, but I don't want to use a plugin for this.