Custom Post Type Meta Boxes
-
Hello all,
I am creating a portfolio website, with a custom post type of project. I would like to create a custom metabox to input project information like client name, project description, and website url for example. based on the codex i have managed to put together this add_meta_boxes function. I understand that it would need to also be saved. the meta box is showing up but the input fields are not.
could anyone help me with the next step or if there is an easier way to do it, it would be much appreciated.
// Create your custom meta box add_action( 'add_meta_boxes', 'projectinfo_add_custom_box' ); // Add a custom meta box to a post function projectinfo_add_custom_box( $post ) { add_meta_box( 'project_info_metabox', // ID, should be a string 'Project Information', // Meta Box Title ' projectinfo_custom_meta_box_content', // Your call back function, this is where your form field will go 'project', // The post type you want this to show up on, can be post, page, or custom post type 'normal', // The placement of your meta box, can be normal or side 'high' // The priority in which this will be displayed ); } function project_info_metabox(){ global $post; // Noncename needed to verify where the data originated echo '<input type="hidden" name="clientname_noncename" id="clientname_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />'; echo '<input type="text" name="_clientname" value="" class="" />'; echo '<input type="textare" name="_Short_project_description" value="" class="" />'; echo '<input type="text" name="_website_link" value="" class="" />'; }
- The topic ‘Custom Post Type Meta Boxes’ is closed to new replies.