Skip to content

Commit

Permalink
Proper heading for admin screens.
Browse files Browse the repository at this point in the history
First step towards restoring a good heading structure in wp-admin.
The previous `<h1>` contained the site title and a link to the front page and was removed with the toolbar refactoring in 3.2.

Props joedolson, afercia.
Fixes #31650.


Built from https://develop.svn.wordpress.org/trunk@32974


git-svn-id: http://core.svn.wordpress.org/trunk@32945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
obenland committed Jun 27, 2015
1 parent aa6a58f commit 7dc1d06
Show file tree
Hide file tree
Showing 63 changed files with 111 additions and 99 deletions.
2 changes: 1 addition & 1 deletion wp-admin/comment.php
Expand Up @@ -117,7 +117,7 @@ function comment_footer_die( $msg ) {
?>
<div class="wrap">

<h2><?php echo esc_html( $title ); ?></h2>
<h1><?php echo esc_html( $title ); ?></h1>

<?php
switch ( $action ) {
Expand Down
3 changes: 3 additions & 0 deletions wp-admin/css/common-rtl.css
Expand Up @@ -328,6 +328,7 @@ h1 {
margin: .67em 0;
}

.wrap > h1,
h2 {
color: #23282d;
font-size: 1.5em;
Expand Down Expand Up @@ -564,12 +565,14 @@ code {
color: #00a0d2;
}

.wrap h1,
.wrap h2,
.subtitle {
font-weight: normal;
margin: 0;
}

.wrap h1,
.wrap h2 {
font-size: 23px;
font-weight: 400;
Expand Down
3 changes: 3 additions & 0 deletions wp-admin/css/common.css
Expand Up @@ -328,6 +328,7 @@ h1 {
margin: .67em 0;
}

.wrap > h1,
h2 {
color: #23282d;
font-size: 1.5em;
Expand Down Expand Up @@ -564,12 +565,14 @@ code {
color: #00a0d2;
}

.wrap h1,
.wrap h2,
.subtitle {
font-weight: normal;
margin: 0;
}

.wrap h1,
.wrap h2 {
font-size: 23px;
font-weight: 400;
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/css/wp-admin-rtl.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-admin/css/wp-admin.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-admin/custom-background.php
Expand Up @@ -176,7 +176,7 @@ public function take_action() {
public function admin_page() {
?>
<div class="wrap" id="custom-background">
<h2><?php _e( 'Custom Background' ); ?></h2>
<h1><?php _e( 'Custom Background' ); ?></h1>

<?php if ( current_user_can( 'customize' ) ) { ?>
<div class="notice notice-info hide-if-no-customize">
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/custom-header.php
Expand Up @@ -446,7 +446,7 @@ public function step_1() {
?>

<div class="wrap">
<h2><?php _e( 'Custom Header' ); ?></h2>
<h1><?php _e( 'Custom Header' ); ?></h1>

<?php if ( current_user_can( 'customize' ) ) { ?>
<div class="notice notice-info hide-if-no-customize">
Expand Down Expand Up @@ -754,7 +754,7 @@ public function step_2() {
?>

<div class="wrap">
<h2><?php _e( 'Crop Header Image' ); ?></h2>
<h1><?php _e( 'Crop Header Image' ); ?></h1>

<form method="post" action="<?php echo esc_url(add_query_arg('step', 3)); ?>">
<p class="hide-if-no-js"><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/edit-comments.php
Expand Up @@ -140,7 +140,7 @@
?>

<div class="wrap">
<h2><?php
<h1><?php
if ( $post_id )
echo sprintf( __( 'Comments on &#8220;%s&#8221;' ),
sprintf( '<a href="%s">%s</a>',
Expand All @@ -153,7 +153,7 @@

if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
echo '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '&hellip;' ) ) . '</span>'; ?>
</h2>
</h1>

<?php
if ( isset( $_REQUEST['error'] ) ) {
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/edit-form-advanced.php
Expand Up @@ -414,11 +414,11 @@
?>

<div class="wrap">
<h2><?php
<h1><?php
echo esc_html( $title );
if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) )
echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
?></h2>
?></h1>
<?php if ( $notice ) : ?>
<div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/edit-form-comment.php
Expand Up @@ -13,7 +13,7 @@
<form name="post" action="comment.php" method="post" id="post">
<?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?>
<div class="wrap">
<h2><?php _e('Edit Comment'); ?></h2>
<h1><?php _e( 'Edit Comment' ); ?></h1>

<div id="poststuff">
<input type="hidden" name="action" value="editedcomment" />
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/edit-link-form.php
Expand Up @@ -70,7 +70,7 @@
?>

<div class="wrap">
<h2><?php echo esc_html( $title ); ?> <a href="link-add.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'link'); ?></a></h2>
<h1><?php echo esc_html( $title ); ?> <a href="link-add.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'link'); ?></a></h1>

<?php if ( isset( $_GET['added'] ) ) : ?>
<div id="message" class="updated notice is-dismissible"><p><?php _e('Link added.'); ?></p></div>
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/edit-tag-form.php
Expand Up @@ -62,7 +62,7 @@
do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?>

<div class="wrap">
<h2><?php echo $tax->labels->edit_item; ?></h2>
<h1><?php echo $tax->labels->edit_item; ?></h1>
<div id="ajax-response"></div>
<form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate"
<?php
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/edit-tags.php
Expand Up @@ -312,10 +312,10 @@
?>

<div class="wrap nosubsub">
<h2><?php echo esc_html( $title );
<h1><?php echo esc_html( $title );
if ( !empty($_REQUEST['s']) )
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?>
</h2>
</h1>

<?php if ( $message ) : ?>
<div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $message; ?></p></div>
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/edit.php
Expand Up @@ -283,13 +283,13 @@
require_once( ABSPATH . 'wp-admin/admin-header.php' );
?>
<div class="wrap">
<h2><?php
<h1><?php
echo esc_html( $post_type_object->labels->name );
if ( current_user_can( $post_type_object->cap->create_posts ) )
echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
if ( ! empty( $_REQUEST['s'] ) )
printf( ' <span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() );
?></h2>
?></h1>

<?php
// If we have a bulk message to issue:
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/export.php
Expand Up @@ -143,7 +143,7 @@ function export_date_options( $post_type = 'post' ) {
?>

<div class="wrap">
<h2><?php echo esc_html( $title ); ?></h2>
<h1><?php echo esc_html( $title ); ?></h1>

<p><?php _e('When you click the button below WordPress will create an XML file for you to save to your computer.'); ?></p>
<p><?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags.'); ?></p>
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/import.php
Expand Up @@ -52,7 +52,7 @@
?>

<div class="wrap">
<h2><?php echo esc_html( $title ); ?></h2>
<h1><?php echo esc_html( $title ); ?></h1>
<?php if ( ! empty( $_GET['invalid'] ) ) : ?>
<div class="error"><p><strong><?php _e('ERROR:')?></strong> <?php printf( __('The <strong>%s</strong> importer is invalid or is not installed.'), esc_html( $_GET['invalid'] ) ); ?></p></div>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/class-wp-upgrader-skins.php
Expand Up @@ -84,7 +84,7 @@ public function header() {
}
$this->done_header = true;
echo '<div class="wrap">';
echo '<h2>' . $this->options['title'] . '</h2>';
echo '<h1>' . $this->options['title'] . '</h1>';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/index.php
Expand Up @@ -93,7 +93,7 @@
?>

<div class="wrap">
<h2><?php echo esc_html( $title ); ?></h2>
<h1><?php echo esc_html( $title ); ?></h1>

<?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
$classes = 'welcome-panel';
Expand Down
8 changes: 7 additions & 1 deletion wp-admin/js/common.js
Expand Up @@ -370,7 +370,13 @@ $(document).ready( function() {
}

// Move .notice, .updated and .error alert boxes. Don't move boxes designed to be inline.
$firstHeading = $( 'div.wrap h2:first' );
$firstHeading = $( '.wrap > h1:first' );

// Back compatibility: if there is no H1, apply to first H2.
if ( ! $firstHeading.length ) {
$firstHeading = $( '.wrap h2:first' );
}

$firstHeading.nextAll( 'div.updated, div.error, div.notice' ).addClass( 'below-h2' );
$( 'div.updated, div.error, div.notice' ).not( '.below-h2, .inline' ).insertAfter( $firstHeading );

Expand Down
2 changes: 1 addition & 1 deletion wp-admin/js/common.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-admin/js/theme.js
Expand Up @@ -84,7 +84,7 @@ themes.view.Appearance = wp.Backbone.View.extend({
},

// Defines search element container
searchContainer: $( '#wpbody h2:first' ),
searchContainer: $( '#wpbody h1:first' ),

// Search input and view
// for current theme collection
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/js/theme.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions wp-admin/link-manager.php
Expand Up @@ -69,10 +69,10 @@
?>

<div class="wrap nosubsub">
<h2><?php echo esc_html( $title ); ?> <a href="link-add.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'link'); ?></a> <?php
<h1><?php echo esc_html( $title ); ?> <a href="link-add.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'link'); ?></a> <?php
if ( !empty($_REQUEST['s']) )
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?>
</h2>
</h1>

<?php
if ( isset($_REQUEST['deleted']) ) {
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/media-new.php
Expand Up @@ -65,7 +65,7 @@
$form_class .= ' html-uploader';
?>
<div class="wrap">
<h2><?php echo esc_html( $title ); ?></h2>
<h1><?php echo esc_html( $title ); ?></h1>

<form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-new.php'); ?>" class="<?php echo esc_attr( $form_class ); ?>" id="file-form">

Expand Down
4 changes: 2 additions & 2 deletions wp-admin/media.php
Expand Up @@ -103,13 +103,13 @@
?>

<div class="wrap">
<h2>
<h1>
<?php
echo esc_html( $title );
if ( current_user_can( 'upload_files' ) ) { ?>
<a href="media-new.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a>
<?php } ?>
</h2>
</h1>

<form method="post" class="media-upload-form" id="media-single-form">
<p class="submit" style="padding-bottom: 0;">
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/ms-delete-site.php
Expand Up @@ -32,7 +32,7 @@
require_once( ABSPATH . 'wp-admin/admin-header.php' );

echo '<div class="wrap">';
echo '<h2>' . esc_html( $title ) . '</h2>';
echo '<h1>' . esc_html( $title ) . '</h1>';

if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) {
check_admin_referer( 'delete-blog' );
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/my-sites.php
Expand Up @@ -56,7 +56,7 @@
<?php } ?>

<div class="wrap">
<h2><?php echo esc_html( $title ); ?></h2>
<h1><?php echo esc_html( $title ); ?></h1>
<?php
if ( empty( $blogs ) ) :
echo '<p>';
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/nav-menus.php
Expand Up @@ -558,12 +558,12 @@ function wp_nav_menu_max_depth( $classes ) {
require_once( ABSPATH . 'wp-admin/admin-header.php' );
?>
<div class="wrap">
<h2 class="nav-tab-wrapper">
<h1 class="nav-tab-wrapper">
<a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' != $_GET['action'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Edit Menus' ); ?></a>
<?php if ( $num_locations && $menu_count ) : ?>
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( $locations_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a>
<?php endif; ?>
</h2>
</h1>
<?php
foreach( $messages as $message ) :
echo $message . "\n";
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/network.php
Expand Up @@ -145,7 +145,7 @@ function get_clean_basedomain() {
include( ABSPATH . 'wp-admin/admin-header.php' );
?>
<div class="wrap">
<h2><?php echo esc_html( $title ); ?></h2>
<h1><?php echo esc_html( $title ); ?></h1>

<?php
/**
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/network/index.php
Expand Up @@ -65,7 +65,7 @@
?>

<div class="wrap">
<h2><?php echo esc_html( $title ); ?></h2>
<h1><?php echo esc_html( $title ); ?></h1>

<div id="dashboard-widgets-wrap">

Expand Down
2 changes: 1 addition & 1 deletion wp-admin/network/settings.php
Expand Up @@ -119,7 +119,7 @@ function network_settings_add_js() {
?>

<div class="wrap">
<h2><?php echo esc_html( $title ); ?></h2>
<h1><?php echo esc_html( $title ); ?></h1>
<form method="post" action="settings.php" novalidate="novalidate">
<?php wp_nonce_field( 'siteoptions' ); ?>
<h3><?php _e( 'Operational Settings' ); ?></h3>
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/network/site-info.php
Expand Up @@ -137,7 +137,7 @@
?>

<div class="wrap">
<h2 id="edit-site"><?php echo $title_site_url_linked ?></h2>
<h1 id="edit-site"><?php echo $title_site_url_linked; ?></h1>
<h3 class="nav-tab-wrapper">
<?php
$tabs = array(
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/network/site-new.php
Expand Up @@ -130,7 +130,7 @@
?>

<div class="wrap">
<h2 id="add-new-site"><?php _e('Add New Site') ?></h2>
<h1 id="add-new-site"><?php _e( 'Add New Site' ); ?></h1>
<?php
if ( ! empty( $messages ) ) {
foreach ( $messages as $msg )
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/network/site-settings.php
Expand Up @@ -87,7 +87,7 @@
?>

<div class="wrap">
<h2 id="edit-site"><?php echo $title_site_url_linked ?></h2>
<h1 id="edit-site"><?php echo $title_site_url_linked; ?></h1>
<h3 class="nav-tab-wrapper">
<?php
$tabs = array(
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/network/site-themes.php
Expand Up @@ -139,7 +139,7 @@
require( ABSPATH . 'wp-admin/admin-header.php' ); ?>

<div class="wrap">
<h2 id="edit-site"><?php echo $title_site_url_linked ?></h2>
<h1 id="edit-site"><?php echo $title_site_url_linked; ?></h1>
<h3 class="nav-tab-wrapper">
<?php
$tabs = array(
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/network/site-users.php
Expand Up @@ -182,7 +182,7 @@


<div class="wrap">
<h2 id="edit-site"><?php echo $title_site_url_linked ?></h2>
<h1 id="edit-site"><?php echo $title_site_url_linked; ?></h1>
<h3 class="nav-tab-wrapper">
<?php
$tabs = array(
Expand Down
6 changes: 3 additions & 3 deletions wp-admin/network/sites.php
Expand Up @@ -67,7 +67,7 @@
require_once( ABSPATH . 'wp-admin/admin-header.php' );
?>
<div class="wrap">
<h2><?php _e( 'Confirm your action' ); ?></h2>
<h1><?php _e( 'Confirm your action' ); ?></h1>
<form action="sites.php?action=<?php echo esc_attr( $_GET['action2'] ) ?>" method="post">
<input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action2'] ) ?>" />
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
Expand Down Expand Up @@ -248,7 +248,7 @@
?>

<div class="wrap">
<h2><?php _e( 'Sites' ) ?>
<h1><?php _e( 'Sites' ); ?>

<?php if ( current_user_can( 'create_sites') ) : ?>
<a href="<?php echo network_admin_url('site-new.php'); ?>" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'site' ); ?></a>
Expand All @@ -257,7 +257,7 @@
<?php if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] ) {
printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
} ?>
</h2>
</h1>

<?php echo $msg; ?>

Expand Down

0 comments on commit 7dc1d06

Please sign in to comment.