-
-
+
+
use them in your template'); ?>
-
-
-
-
+
()
pingbacks, no other action necessary.'); ?>
@@ -290,15 +291,13 @@
if ( ! empty($pings) )
echo $pings;
-?>
-
-
-
-
+}
+add_meta_box('trackbacksdiv', __('Trackbacks'), 'post_trackback_meta_box', 'post', 'advanced', 'core');
+
+function post_custom_meta_box($post) {
+?>
ID);
list_meta($metadata);
?>
@@ -311,12 +310,12 @@
use in your theme.'); ?>
-
-
-
-
-
-
-
-
-
-
-
-id ); // TODO: ROLE SYSTEM
if ( $post->post_author && !in_array($post->post_author, $authors) )
$authors[] = $post->post_author;
if ( $authors && count( $authors ) > 1 ) :
-?>
-
-
-
+function post_author_meta_box($post) {
+?>
$authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
-
-
-
-
-
-
-
-
-
-
-
+
Index: /trunk/wp-admin/includes/template.php
===================================================================
--- /trunk/wp-admin/includes/template.php (revision 7929)
+++ /trunk/wp-admin/includes/template.php (revision 7930)
@@ -1042,8 +1042,10 @@
* @param string $page The type of edit page on which to show the box (post, page, link)
* @param string $context The context within the page where the boxes should show ('normal', 'advanced')
+ * @param string $priority The priority within the context where the boxes should show ('high', 'low')
*/
-function add_meta_box($id, $title, $callback, $page, $context = 'advanced') {
+function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
global $wp_meta_boxes;
+
if ( !isset($wp_meta_boxes) )
$wp_meta_boxes = array();
@@ -1053,5 +1055,34 @@
$wp_meta_boxes[$page][$context] = array();
- $wp_meta_boxes[$page][$context][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
+ foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
+ if ( !isset($wp_meta_boxes[$page][$context][$a_priority][$id]) )
+ continue;
+ // If a core box was previously added or removed by a plugin, don't add.
+ if ( 'core' == $priority ) {
+ // If core box previously deleted, don't add
+ if ( false === $wp_meta_boxes[$page][$context][$a_priority][$id] )
+ return;
+ // If box was added with default priority, give it core priority to maintain sort order
+ if ( 'default' == $a_priority ) {
+ $wp_meta_boxes[$page][$context]['core'][$id] = $wp_meta_boxes[$page][$context]['default'][$id];
+ unset($wp_meta_boxes[$page][$context]['default'][$id]);
+ }
+ return;
+ }
+ // If no priority given and id already present, use existing priority
+ if ( empty($priority) )
+ $priority = $a_priority;
+ // An id can be in only one priority
+ if ( $priority != $a_priority )
+ unset($wp_meta_boxes[$page][$context][$a_priority][$id]);
+ }
+
+ if ( empty($priority) )
+ $priority = low;
+
+ if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
+ $wp_meta_boxes[$page][$context][$priority] = array();
+
+ $wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
}
@@ -1059,15 +1090,44 @@
global $wp_meta_boxes;
+ do_action('do_meta_boxes', $page, $context, $object);
+
if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
return;
- foreach ( (array) $wp_meta_boxes[$page][$context] as $box ) {
- echo '' . "\n";
- echo "
{$box['title']} \n";
- echo '
' . "\n";
- call_user_func($box['callback'], $object, $box);
- echo "
\n";
- echo "
\n";
- }
+ foreach ( array('high', 'core', 'default', 'low') as $priority ) {
+ foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
+ if ( false === $box )
+ continue;
+ echo '' . "\n";
+ echo "
{$box['title']} \n";
+ echo '
' . "\n";
+ call_user_func($box['callback'], $object, $box);
+ echo "
\n";
+ echo "
\n";
+ }
+ }
+}
+
+/**
+ * remove_meta_box() - Remove a meta box from an edit form
+ *
+ * @since 2.6
+ *
+ * @param string $id String for use in the 'id' attribute of tags.
+ * @param string $page The type of edit page on which to show the box (post, page, link)
+ * @param string $context The context within the page where the boxes should show ('normal', 'advanced')
+ */
+function remove_meta_box($id, $page, $context) {
+ global $wp_meta_boxes;
+
+ if ( !isset($wp_meta_boxes) )
+ $wp_meta_boxes = array();
+ if ( !isset($wp_meta_boxes[$page]) )
+ $wp_meta_boxes[$page] = array();
+ if ( !isset($wp_meta_boxes[$page][$context]) )
+ $wp_meta_boxes[$page][$context] = array();
+
+ foreach ( array('high', 'core', 'default', 'low') as $priority )
+ $wp_meta_boxes[$page][$context][$priority][$id] = false;
}