如何设置wordpress元框位置

时间:2012-03-14 20:31:01

标签: php html wordpress

所以我有一个自定义元数据,我需要它在帖子标题之后,有没有办法设置位置顺序?

// LE 不起作用:

//create a variable and store the widget
$widget1 = $wp_meta_boxes['dashboard']['normal']['core']['information'];

// unset both widgets
unset($wp_meta_boxes['dashboard']['normal']['core']['information']);

//re insert widget in the order you want
$wp_meta_boxes['dashboard']['normal']['core']['information'] = $widget1;

1 个答案:

答案 0 :(得分:3)

这是一个关于强制您的信息中心小部件到顶部的link。该理论可用于排列帖子/页面元框。

//create a variable and store the widget
$widget1 = $wp_meta_boxes['dashboard']['normal']['core']['your widget id'];
$widget2 = $wp_meta_boxes['dashboard']['normal']['core']['other widget id'];

// unset both widgets
unset($wp_meta_boxes['dashboard']['normal']['core']['your widget id']);
unset($wp_meta_boxes['dashboard']['normal']['core']['other widget id']);

//re insert widget in the order you want
$wp_meta_boxes['dashboard']['normal']['core']['other widget id'] = $widget2;
$wp_meta_boxes['dashboard']['normal']['core']['your widget id'] = $widget1;

您还可以使用jQuery在显示后移动框

$('#pageparentdiv').prependTo('#normal-sortables');
$('#panel_38').insertAfter('#pageparentdiv');