您可以致电:
add_meta_box( $widget_id, $widget_name, $callback, $screen->id, $location, $priority );
其中,通过以下方式获得屏幕ID:
$screen = get_current_screen();
然后显示每个位置,例如:
do_meta_boxes( $screen->id, \'column3\', \'\' );
以下是显示仪表板的仪表板功能:
function wp_dashboard() {
global $screen_layout_columns;
$screen = get_current_screen();
$hide2 = $hide3 = $hide4 = \'\';
switch ( $screen_layout_columns ) {
case 4:
$width = \'width:24.5%;\';
break;
case 3:
$width = \'width:32.67%;\';
$hide4 = \'display:none;\';
break;
case 2:
$width = \'width:49%;\';
$hide3 = $hide4 = \'display:none;\';
break;
default:
$width = \'width:98%;\';
$hide2 = $hide3 = $hide4 = \'display:none;\';
}
?>
<div id="dashboard-widgets" class="metabox-holder">
<?php
echo "\\t<div class=\'postbox-container\' style=\'$width\'>\\n";
do_meta_boxes( $screen->id, \'normal\', \'\' );
echo "\\t</div><div class=\'postbox-container\' style=\'{$hide2}$width\'>\\n";
do_meta_boxes( $screen->id, \'side\', \'\' );
echo "\\t</div><div class=\'postbox-container\' style=\'{$hide3}$width\'>\\n";
do_meta_boxes( $screen->id, \'column3\', \'\' );
echo "\\t</div><div class=\'postbox-container\' style=\'{$hide4}$width\'>\\n";
do_meta_boxes( $screen->id, \'column4\', \'\' );
?>
</div></div>
<form style="display:none" method="get" action="">
<p>
<?php
wp_nonce_field( \'closedpostboxes\', \'closedpostboxesnonce\', false );
wp_nonce_field( \'meta-box-order\', \'meta-box-order-nonce\', false );
?>
</p>
</form>
<?php
}
有关更多参考,请参阅wp admin/index。php和包含的仪表板文件。