Changeset 6762
- Timestamp:
- 02/08/2008 09:06:15 PM (17 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r6761 r6762 220 220 </div> 221 221 222 <?php do_meta_boxes(' edit_post', $post); ?>222 <?php do_meta_boxes('post', 'normal', $post); ?> 223 223 224 224 <?php do_action('edit_form_advanced'); ?> … … 319 319 <?php endif; ?> 320 320 321 <?php do_meta_boxes(' edit_post_advanced', $post); ?>321 <?php do_meta_boxes('post', 'advanced', $post); ?> 322 322 323 323 <?php do_action('dbx_post_sidebar'); ?> -
trunk/wp-admin/edit-link-form.php
r6761 r6762 99 99 </div> 100 100 </div> 101 102 <?php do_meta_boxes('link', 'normal', $link); ?> 101 103 102 104 <h2><?php _e('Advanced Options'); ?></h2> … … 275 277 </div> 276 278 279 <?php do_meta_boxes('link', 'advanced', $link); ?> 280 277 281 <?php if ( $link_id ) : ?> 278 282 <input type="hidden" name="action" value="save" /> -
trunk/wp-admin/edit-page-form.php
r6761 r6762 134 134 </p> 135 135 136 <?php do_meta_boxes('post', 'normal', $post); ?> 137 136 138 <?php do_action('edit_page_form'); ?> 137 139 … … 225 227 <?php endif; ?> 226 228 229 <?php do_meta_boxes('page', 'advanced', $post); ?> 230 227 231 </div> 228 232 -
trunk/wp-admin/includes/template.php
r6758 r6762 854 854 * @param string $title Title of the meta box 855 855 * @param string $callback Function that fills the box with the desired content. The function should echo its output. 856 * @param string $context The context in which the box should be displayed. edit_post, edit_page, edit_link, edit_post_advanced... 856 * @param string $page The type of edit page on which to show the box (post, page, link) 857 * @param string $context The context within the page where the boxes should show ('normal', 'advanced') 857 858 */ 858 function add_meta_box($id, $title, $callback, $ context) {859 function add_meta_box($id, $title, $callback, $page, $context = 'advanced') { 859 860 global $wp_meta_boxes; 860 861 861 $wp_meta_boxes[$context][] = array('id' => $id, 'title' => $title, 'callback' => $callback); 862 } 863 864 function do_meta_boxes($context, $object) { 862 if ( !isset($wp_meta_boxes) ) 863 $wp_meta_boxes = array(); 864 if ( !isset($wp_meta_boxes[$page]) ) 865 $wp_meta_boxes[$page] = array(); 866 if ( !isset($wp_meta_boxes[$page][$context]) ) 867 $wp_meta_boxes[$page][$context] = array(); 868 869 $wp_meta_boxes[$page][$context][] = array('id' => $id, 'title' => $title, 'callback' => $callback); 870 } 871 872 function do_meta_boxes($page, $context, $object) { 865 873 global $wp_meta_boxes; 866 874 867 if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$ context]) )875 if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) ) 868 876 return; 869 877 870 foreach ( (array) $wp_meta_boxes[$ context] as $box ) {871 echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'] ) . '">' . "\n";878 foreach ( (array) $wp_meta_boxes[$page][$context] as $box ) { 879 echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n"; 872 880 echo "<h3>{$box['title']}</h3>\n"; 873 881 echo '<div class="inside">' . "\n"; … … 878 886 } 879 887 880 ?> 888 function test_box($post) { 889 echo "Hello $post->ID"; 890 } 891 892 add_meta_box('test', 'Test', 'test_box', 'post'); 893 ?>
Note: See TracChangeset
for help on using the changeset viewer.