2012-03-14 1 views
0

私はカスタムメタボックスを持っているので、それはポストタイトルの後にする必要がある、位置の順序を設定する方法はありますか?wordpress metaboxの位置を設定する方法

// 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; 

答えて

3

これは、先頭にダッシュボードウィジェットを強制程度linkです。この理論は、ポスト/ページメタボックスの配置に使用できます。彼らは

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

'//変数を作成し、ウィジェットを保存 $ WIDGET1 = $ wp_meta_boxes [ 'ダッシュボード']が表示された後、あなたはまた、「通常の[ボックスを移動するためのjQueryを使用することができます

//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; 

'] [' core '] [' information ']; //両方のウィジェットを設定解除します unset($ wp_meta_boxes ['dashboard'] ['normal'] ['core'] ['information']); //ウィジェットを必要な順序で再挿入します $ [wiki] ['dashboard'] ['core'] ['information'] = '$ widget1;'そして動作しません – Uffo

+0

コードサンプルはダッシュボードウィジェット用。ポスト/ページのメタボックス用に変更する必要がありますが、理論は変わりません。変数としてメタボックスを保存し、メタボックスを削除し、変数をメタボックスとして挿入します。 – Nick

+0

私のカスタムポストタイプでは、このようにする必要があります:ポストタイトル、カスタムメタボックス、エディタなど... – Uffo

関連する問題