Did just that for one of my plugins, recently…
function render($post) {
$pages = wp_dropdown_pages(array('post_type' => 'page', 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)'), 'sort_column'=> 'menu_order, post_title', 'echo' => 0));
if (!empty($pages)) {
?>
<p><strong><?php _e('Parent') ?></strong></p>
<label class="screen-reader-text" for="parent_id"><?php _e('Landing Page') ?></label>
<?php echo $pages; ?>
<?php
}
?>
<?php
}
I implement my metaboxes as classes, hence the funny function name.
I removed the menu order field which i originally kept in my metabox. I think it’s a good idea to keep it.
You’ll find the original ‘attributes’ metabox in wp-admin/includes/meta-boxes.php
, btw., which is a nice library of code to have a look at if you implement custom metaboxes.