3 * WordPress Administration Template Header
6 * @subpackage Administration
9 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
10 if ( ! defined( 'WP_ADMIN' ) )
11 require_once( dirname( __FILE__ ) . '/admin.php' );
14 * In case admin-header.php is included in a function.
16 * @global string $title
17 * @global string $hook_suffix
18 * @global WP_Screen $current_screen
19 * @global WP_Locale $wp_locale
20 * @global string $pagenow
21 * @global string $wp_version
22 * @global string $update_title
23 * @global int $total_update_count
24 * @global string $parent_file
26 global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version,
27 $update_title, $total_update_count, $parent_file;
29 // Catch plugins that include admin-header.php before admin.php completes.
30 if ( empty( $current_screen ) )
33 get_admin_page_title();
34 $title = esc_html( strip_tags( $title ) );
36 if ( is_network_admin() )
37 $admin_title = sprintf( __( 'Network Admin: %s' ), esc_html( get_current_site()->site_name ) );
38 elseif ( is_user_admin() )
39 $admin_title = sprintf( __( 'User Dashboard: %s' ), esc_html( get_current_site()->site_name ) );
41 $admin_title = get_bloginfo( 'name' );
43 if ( $admin_title == $title )
44 $admin_title = sprintf( __( '%1$s — WordPress' ), $title );
46 $admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $admin_title );
49 * Filters the title tag content for an admin page.
53 * @param string $admin_title The page title, with extra context added.
54 * @param string $title The original page title.
56 $admin_title = apply_filters( 'admin_title', $admin_title, $title );
60 _wp_admin_html_begin();
62 <title><?php echo $admin_title; ?></title>
65 wp_enqueue_style( 'colors' );
66 wp_enqueue_style( 'ie' );
67 wp_enqueue_script('utils');
68 wp_enqueue_script( 'svg-painter' );
70 $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
72 <script type="text/javascript">
73 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
74 var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
75 pagenow = '<?php echo $current_screen->id; ?>',
76 typenow = '<?php echo $current_screen->post_type; ?>',
77 adminpage = '<?php echo $admin_body_class; ?>',
78 thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
79 decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
80 isRtl = <?php echo (int) is_rtl(); ?>;
82 <meta name="viewport" content="width=device-width,initial-scale=1.0">
86 * Enqueue scripts for all admin pages.
90 * @param string $hook_suffix The current admin page.
92 do_action( 'admin_enqueue_scripts', $hook_suffix );
95 * Fires when styles are printed for a specific admin page based on $hook_suffix.
99 do_action( "admin_print_styles-$hook_suffix" );
102 * Fires when styles are printed for all admin pages.
106 do_action( 'admin_print_styles' );
109 * Fires when scripts are printed for a specific admin page based on $hook_suffix.
113 do_action( "admin_print_scripts-$hook_suffix" );
116 * Fires when scripts are printed for all admin pages.
120 do_action( 'admin_print_scripts' );
123 * Fires in head section for a specific admin page.
125 * The dynamic portion of the hook, `$hook_suffix`, refers to the hook suffix
126 * for the admin page.
130 do_action( "admin_head-$hook_suffix" );
133 * Fires in head section for all admin pages.
137 do_action( 'admin_head' );
139 if ( get_user_setting('mfold') == 'f' )
140 $admin_body_class .= ' folded';
142 if ( !get_user_setting('unfold') )
143 $admin_body_class .= ' auto-fold';
145 if ( is_admin_bar_showing() )
146 $admin_body_class .= ' admin-bar';
149 $admin_body_class .= ' rtl';
151 if ( $current_screen->post_type )
152 $admin_body_class .= ' post-type-' . $current_screen->post_type;
154 if ( $current_screen->taxonomy )
155 $admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
157 $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
158 $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
159 $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
160 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
162 if ( wp_is_mobile() )
163 $admin_body_class .= ' mobile';
165 if ( is_multisite() )
166 $admin_body_class .= ' multisite';
168 if ( is_network_admin() )
169 $admin_body_class .= ' network-admin';
171 $admin_body_class .= ' no-customize-support no-svg';
177 * Filters the CSS classes for the body tag in the admin.
179 * This filter differs from the {@see 'post_class'} and {@see 'body_class'} filters
180 * in two important ways:
182 * 1. `$classes` is a space-separated string of class names instead of an array.
183 * 2. Not all core admin classes are filterable, notably: wp-admin, wp-core-ui,
184 * and no-js cannot be removed.
188 * @param string $classes Space-separated list of CSS classes.
190 $admin_body_classes = apply_filters( 'admin_body_class', '' );
192 <body class="wp-admin wp-core-ui no-js <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
193 <script type="text/javascript">
194 document.body.className = document.body.className.replace('no-js','js');
198 // Make sure the customize body classes are correct as early as possible.
199 if ( current_user_can( 'customize' ) ) {
200 wp_customize_support_script();
205 <?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
210 * Fires at the beginning of the content section in an admin page.
214 do_action( 'in_admin_header' );
217 <div id="wpbody" role="main">
219 unset($title_class, $blog_name, $total_update_count, $update_title);
221 $current_screen->set_parentage( $parent_file );
225 <div id="wpbody-content" aria-label="<?php esc_attr_e('Main content'); ?>" tabindex="0">
228 $current_screen->render_screen_meta();
230 if ( is_network_admin() ) {
232 * Prints network admin screen notices.
236 do_action( 'network_admin_notices' );
237 } elseif ( is_user_admin() ) {
239 * Prints user admin screen notices.
243 do_action( 'user_admin_notices' );
246 * Prints admin screen notices.
250 do_action( 'admin_notices' );
254 * Prints generic admin screen notices.
258 do_action( 'all_admin_notices' );
260 if ( $parent_file == 'options-general.php' )
261 require(ABSPATH . 'wp-admin/options-head.php');