Changeset 34951 for trunk/src/wp-admin/includes/template-functions.php
- Timestamp:
- 10/08/2015 07:06:32 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/template-functions.php
r34893 r34951 848 848 849 849 /** 850 * Add a meta box to an edit form.850 * Adds a meta box to one or more screens. 851 851 * 852 852 * @since 2.5.0 853 * @since 4.4.0 The `$screen` parameter now accepts an array of screen IDs. 853 854 * 854 855 * @global array $wp_meta_boxes … … 858 859 * @param callable $callback Function that fills the box with the desired content. 859 860 * The function should echo its output. 860 * @param string|WP_Screen $screen Optional. The screen on which to show the box (like a post 861 * type, 'link', or 'comment'). Default is the current screen. 861 * @param string|array|WP_Screen $screen Optional. The screen or screens on which to show the box 862 * (such as a post type, 'link', or 'comment'). Accepts a single 863 * screen ID, WP_Screen object, or array of screen IDs. Default 864 * is the current screen. 862 865 * @param string $context Optional. The context within the screen where the boxes 863 866 * should display. Available contexts vary from screen to … … 875 878 global $wp_meta_boxes; 876 879 877 if ( empty( $screen ) ) 880 if ( empty( $screen ) ) { 878 881 $screen = get_current_screen(); 879 elseif ( is_string( $screen ) )882 } elseif ( is_string( $screen ) ) { 880 883 $screen = convert_to_screen( $screen ); 884 } elseif ( is_array( $screen ) ) { 885 foreach ( $screen as $single_screen ) { 886 add_meta_box( $id, $title, $callback, $single_screen, $context, $priority, $callback_args ); 887 } 888 } 889 890 if ( ! isset( $screen->id ) ) { 891 return; 892 } 881 893 882 894 $page = $screen->id; … … 1012 1024 1013 1025 /** 1014 * Remove a meta box from an edit form.1026 * Removes a meta box from one or more screens. 1015 1027 * 1016 1028 * @since 2.6.0 1029 * @since 4.4.0 The `$screen` parameter now accepts an array of screen IDs. 1017 1030 * 1018 1031 * @global array $wp_meta_boxes 1019 1032 * 1020 1033 * @param string $id String for use in the 'id' attribute of tags. 1021 * @param string|object $screen The screen on which to show the box (post, page, link). 1034 * @param string|array|WP_Screen $screen The screen or screens on which the meta box is shown (such as a 1035 * post type, 'link', or 'comment'). Accepts a single screen ID, 1036 * WP_Screen object, or array of screen IDs. 1022 1037 * @param string $context The context within the page where the boxes should show ('normal', 'advanced'). 1023 1038 */ 1024 function remove_meta_box( $id, $screen, $context) {1039 function remove_meta_box( $id, $screen, $context ) { 1025 1040 global $wp_meta_boxes; 1026 1041 1027 if ( empty( $screen ) ) 1042 if ( empty( $screen ) ) { 1028 1043 $screen = get_current_screen(); 1029 elseif ( is_string( $screen ) )1044 } elseif ( is_string( $screen ) ) { 1030 1045 $screen = convert_to_screen( $screen ); 1046 } elseif ( is_array( $screen ) ) { 1047 foreach ( $screen as $single_screen ) { 1048 remove_meta_box( $id, $single_screen, $context ); 1049 } 1050 } 1051 1052 if ( ! isset( $screen->id ) ) { 1053 return; 1054 } 1031 1055 1032 1056 $page = $screen->id;
Note: See TracChangeset
for help on using the changeset viewer.