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' );
13 // In case admin-header.php is included in a function.
14 global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version,
15 $update_title, $total_update_count, $parent_file;
17 // Catch plugins that include admin-header.php before admin.php completes.
18 if ( empty( $current_screen ) )
21 get_admin_page_title();
22 $title = esc_html( strip_tags( $title ) );
24 if ( is_network_admin() )
25 $admin_title = sprintf( __( 'Network Admin: %s' ), esc_html( get_current_site()->site_name ) );
26 elseif ( is_user_admin() )
27 $admin_title = sprintf( __( 'Global Dashboard: %s' ), esc_html( get_current_site()->site_name ) );
29 $admin_title = get_bloginfo( 'name' );
31 if ( $admin_title == $title )
32 $admin_title = sprintf( __( '%1$s — WordPress' ), $title );
34 $admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $admin_title );
37 * Filter the <title> content for an admin page.
41 * @param string $admin_title The page title, with extra context added.
42 * @param string $title The original page title.
44 $admin_title = apply_filters( 'admin_title', $admin_title, $title );
48 _wp_admin_html_begin();
50 <title><?php echo $admin_title; ?></title>
53 wp_enqueue_style( 'colors' );
54 wp_enqueue_style( 'ie' );
55 wp_enqueue_script('utils');
56 wp_enqueue_script( 'svg-painter' );
58 $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
60 <script type="text/javascript">
61 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();}}};
62 var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
63 pagenow = '<?php echo $current_screen->id; ?>',
64 typenow = '<?php echo $current_screen->post_type; ?>',
65 adminpage = '<?php echo $admin_body_class; ?>',
66 thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
67 decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
68 isRtl = <?php echo (int) is_rtl(); ?>;
70 <meta name="viewport" content="width=device-width,initial-scale=1.0">
74 * Enqueue scripts for all admin pages.
78 * @param string $hook_suffix The current admin page.
80 do_action( 'admin_enqueue_scripts', $hook_suffix );
83 * Fires when styles are printed for a specific admin page based on $hook_suffix.
87 do_action( "admin_print_styles-$hook_suffix" );
90 * Fires when styles are printed for all admin pages.
94 do_action( 'admin_print_styles' );
97 * Fires when scripts are printed for a specific admin page based on $hook_suffix.
101 do_action( "admin_print_scripts-$hook_suffix" );
104 * Fires when scripts are printed for all admin pages.
108 do_action( 'admin_print_scripts' );
111 * Fires in <head> for a specific admin page based on $hook_suffix.
115 do_action( "admin_head-$hook_suffix" );
118 * Fires in <head> for all admin pages.
122 do_action( 'admin_head' );
124 if ( get_user_setting('mfold') == 'f' )
125 $admin_body_class .= ' folded';
127 if ( !get_user_setting('unfold') )
128 $admin_body_class .= ' auto-fold';
130 if ( is_admin_bar_showing() )
131 $admin_body_class .= ' admin-bar';
134 $admin_body_class .= ' rtl';
136 if ( $current_screen->post_type )
137 $admin_body_class .= ' post-type-' . $current_screen->post_type;
139 if ( $current_screen->taxonomy )
140 $admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
142 $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
143 $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
144 $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
145 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
147 if ( wp_is_mobile() )
148 $admin_body_class .= ' mobile';
150 if ( is_multisite() )
151 $admin_body_class .= ' multisite';
153 if ( is_network_admin() )
154 $admin_body_class .= ' network-admin';
156 $admin_body_class .= ' no-customize-support no-svg';
162 * Filter the admin <body> CSS classes.
164 * This filter differs from the post_class or body_class filters in two important ways:
165 * 1. $classes is a space-separated string of class names instead of an array.
166 * 2. Not all core admin classes are filterable, notably: wp-admin, wp-core-ui, and no-js cannot be removed.
170 * @param string $classes Space-separated string of CSS classes.
173 <body class="wp-admin wp-core-ui no-js <?php echo apply_filters( 'admin_body_class', '' ) . " $admin_body_class"; ?>">
174 <script type="text/javascript">
175 document.body.className = document.body.className.replace('no-js','js');
179 // Make sure the customize body classes are correct as early as possible.
180 if ( current_user_can( 'customize' ) ) {
181 wp_customize_support_script();
186 <a tabindex="1" href="#wpbody-content" class="screen-reader-shortcut"><?php _e('Skip to main content'); ?></a>
187 <?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
192 * Fires at the beginning of the content section in an admin page.
196 do_action( 'in_admin_header' );
201 unset($title_class, $blog_name, $total_update_count, $update_title);
203 $current_screen->set_parentage( $parent_file );
207 <div id="wpbody-content" aria-label="<?php esc_attr_e('Main content'); ?>" tabindex="0">
210 $current_screen->render_screen_meta();
212 if ( is_network_admin() ) {
214 * Print network admin screen notices.
218 do_action( 'network_admin_notices' );
219 } elseif ( is_user_admin() ) {
221 * Print user admin screen notices.
225 do_action( 'user_admin_notices' );
228 * Print admin screen notices.
232 do_action( 'admin_notices' );
236 * Print generic admin screen notices.
240 do_action( 'all_admin_notices' );
242 if ( $parent_file == 'options-general.php' )
243 require(ABSPATH . 'wp-admin/options-head.php');