I am trying to mimic the dashboard meta boxes UI in my WP plugin – the small metaboxes. I have already styled them and also the drag & drop feature works as I loaded the following script and style:
wp_enqueue_style('dashboard');
wp_enqueue_script('dashboard');
However I also would like to save my custom “postboxes” position (order) and also the open/close state.
Any ideas how could this be achieved?
Thanks.
UPDATE:
This is the structure of my postbox:
<div class="wrap">
<h2><?php echo get_admin_page_title(); ?></h2>
<div class="postbox-container" style="width: 100%">
<div class="metabox-holder">
<div class="meta-box-sortables">
<div class="postbox" id="first">
<div class="handlediv" title="Click to toggle"><br /></div>
<h3 class="hndle"><span><?php echo get_admin_page_title(); ?></span></h3>
<div class="inside">
<p>first</p>
</div>
</div>
<div class="postbox" id="second">
<div class="handlediv" title="Click to toggle"><br /></div>
<h3 class="hndle"><span><?php echo get_admin_page_title(); ?></span></h3>
<div class="inside">
<p>second</p>
</div>
</div>
</div>
</div>
</div>
<form style="display:none" method="get" action="">
<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?>
</form>
</div>