You May Also Be Interested In

//Add the meta box callback function function admin_init(){ add_meta_box("listings_parent_id", "Listings Parent ID", "set_listings_parent_id", "listings", "normal", "low"); } add_action("admin_init", "admin_init"); //Meta box for setting the parent ID function set_listings_parent_id() { global $post; $custom = get_post_custom($post->ID); $parent_id = $custom['parent_id'][0]; ?>

Please specify the ID of the page or post to be a parent to this Listing.

Leave blank for no heirarchy. Case studies will appear from the server root with no assocaited parent page or post.

'; } // Save the meta data function save_listings_parent_id($post_id) { global $post; // make sure data came from our meta box if (!wp_verify_nonce($_POST['parent_id_noncename'],__FILE__)) return $post_id; if(isset($_POST['parent_id']) && ($_POST['post_type'] == "casestudy")) { $data = $_POST['parent_id']; update_post_meta($post_id, 'parent_id', $data); } } add_action("save_post", "save_case_study_parent_id");