mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-01 21:21:24 +01:00
Screen Options: Improve items per page option label.
Previously the label just said "Posts", "Pages", or "Comments". This was bad in terms of accessibility and internationalization because of missing context. This change adds a default label "Number of items per page:" to `WP_Screen->render_per_page_options()` and removes all the existing one-word labels. props afercia. fixes #31349, #15576. Built from https://develop.svn.wordpress.org/trunk@31696 git-svn-id: http://core.svn.wordpress.org/trunk@31677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
70b7369935
commit
13ad2d4e16
@ -1506,6 +1506,26 @@ form.upgrade .hint {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.metabox-prefs .screen-options {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metabox-prefs .screen-options input,
|
||||||
|
.metabox-prefs .screen-options label {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metabox-prefs .screen-options .screen-per-page {
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metabox-prefs .screen-options label {
|
||||||
|
line-height: 28px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
6.2 - Help Menu
|
6.2 - Help Menu
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -1506,6 +1506,26 @@ form.upgrade .hint {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.metabox-prefs .screen-options {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metabox-prefs .screen-options input,
|
||||||
|
.metabox-prefs .screen-options label {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metabox-prefs .screen-options .screen-per-page {
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metabox-prefs .screen-options label {
|
||||||
|
line-height: 28px;
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
6.2 - Help Menu
|
6.2 - Help Menu
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
2
wp-admin/css/wp-admin-rtl.min.css
vendored
2
wp-admin/css/wp-admin-rtl.min.css
vendored
File diff suppressed because one or more lines are too long
2
wp-admin/css/wp-admin.min.css
vendored
2
wp-admin/css/wp-admin.min.css
vendored
File diff suppressed because one or more lines are too long
@ -109,7 +109,7 @@ if ( $post_id )
|
|||||||
else
|
else
|
||||||
$title = __('Comments');
|
$title = __('Comments');
|
||||||
|
|
||||||
add_screen_option( 'per_page', array('label' => _x( 'Comments', 'comments per page (screen options)' )) );
|
add_screen_option( 'per_page' );
|
||||||
|
|
||||||
get_current_screen()->add_help_tab( array(
|
get_current_screen()->add_help_tab( array(
|
||||||
'id' => 'overview',
|
'id' => 'overview',
|
||||||
|
@ -39,7 +39,7 @@ if ( 'post' != $post_type ) {
|
|||||||
$submenu_file = "edit-tags.php?taxonomy=$taxonomy";
|
$submenu_file = "edit-tags.php?taxonomy=$taxonomy";
|
||||||
}
|
}
|
||||||
|
|
||||||
add_screen_option( 'per_page', array( 'label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page' ) );
|
add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page' ) );
|
||||||
|
|
||||||
$location = false;
|
$location = false;
|
||||||
|
|
||||||
|
@ -165,8 +165,6 @@ $wp_list_table->prepare_items();
|
|||||||
wp_enqueue_script('inline-edit-post');
|
wp_enqueue_script('inline-edit-post');
|
||||||
wp_enqueue_script('heartbeat');
|
wp_enqueue_script('heartbeat');
|
||||||
|
|
||||||
$title = $post_type_object->labels->name;
|
|
||||||
|
|
||||||
if ( 'post' == $post_type ) {
|
if ( 'post' == $post_type ) {
|
||||||
get_current_screen()->add_help_tab( array(
|
get_current_screen()->add_help_tab( array(
|
||||||
'id' => 'overview',
|
'id' => 'overview',
|
||||||
@ -234,7 +232,7 @@ if ( 'post' == $post_type ) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_screen_option( 'per_page', array( 'label' => $title, 'default' => 20, 'option' => 'edit_' . $post_type . '_per_page' ) );
|
add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'edit_' . $post_type . '_per_page' ) );
|
||||||
|
|
||||||
$bulk_counts = array(
|
$bulk_counts = array(
|
||||||
'updated' => isset( $_REQUEST['updated'] ) ? absint( $_REQUEST['updated'] ) : 0,
|
'updated' => isset( $_REQUEST['updated'] ) ? absint( $_REQUEST['updated'] ) : 0,
|
||||||
|
@ -1127,20 +1127,26 @@ final class WP_Screen {
|
|||||||
* @since 3.3.0
|
* @since 3.3.0
|
||||||
*/
|
*/
|
||||||
public function render_per_page_options() {
|
public function render_per_page_options() {
|
||||||
if ( ! $this->get_option( 'per_page' ) )
|
if ( null === $this->get_option( 'per_page' ) ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$per_page_label = $this->get_option( 'per_page', 'label' );
|
$per_page_label = $this->get_option( 'per_page', 'label' );
|
||||||
|
if ( null === $per_page_label ) {
|
||||||
|
$per_page_label = __( 'Number of items per page:' );
|
||||||
|
}
|
||||||
|
|
||||||
$option = $this->get_option( 'per_page', 'option' );
|
$option = $this->get_option( 'per_page', 'option' );
|
||||||
if ( ! $option )
|
if ( ! $option ) {
|
||||||
$option = str_replace( '-', '_', "{$this->id}_per_page" );
|
$option = str_replace( '-', '_', "{$this->id}_per_page" );
|
||||||
|
}
|
||||||
|
|
||||||
$per_page = (int) get_user_option( $option );
|
$per_page = (int) get_user_option( $option );
|
||||||
if ( empty( $per_page ) || $per_page < 1 ) {
|
if ( empty( $per_page ) || $per_page < 1 ) {
|
||||||
$per_page = $this->get_option( 'per_page', 'default' );
|
$per_page = $this->get_option( 'per_page', 'default' );
|
||||||
if ( ! $per_page )
|
if ( ! $per_page ) {
|
||||||
$per_page = 20;
|
$per_page = 20;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'edit_comments_per_page' == $option ) {
|
if ( 'edit_comments_per_page' == $option ) {
|
||||||
@ -1165,16 +1171,14 @@ final class WP_Screen {
|
|||||||
?>
|
?>
|
||||||
<div class="screen-options">
|
<div class="screen-options">
|
||||||
<?php if ( $per_page_label ) : ?>
|
<?php if ( $per_page_label ) : ?>
|
||||||
|
<label for="<?php echo esc_attr( $option ); ?>"><?php echo $per_page_label; ?></label>
|
||||||
<input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]"
|
<input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]"
|
||||||
id="<?php echo esc_attr( $option ); ?>" maxlength="3"
|
id="<?php echo esc_attr( $option ); ?>" maxlength="3"
|
||||||
value="<?php echo esc_attr( $per_page ); ?>" />
|
value="<?php echo esc_attr( $per_page ); ?>" />
|
||||||
<label for="<?php echo esc_attr( $option ); ?>">
|
|
||||||
<?php echo esc_html( $per_page_label ); ?>
|
|
||||||
</label>
|
|
||||||
<?php endif;
|
<?php endif;
|
||||||
|
|
||||||
echo get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ); ?>
|
echo get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ); ?>
|
||||||
<input type='hidden' name='wp_screen_options[option]' value='<?php echo esc_attr($option); ?>' />
|
<input type="hidden" name="wp_screen_options[option]" value="<?php echo esc_attr( $option ); ?>" />
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_thickbox();
|
add_thickbox();
|
||||||
add_screen_option( 'per_page', array( 'label' => _x( 'Themes', 'themes per page (screen options)' ) ) );
|
add_screen_option( 'per_page' );
|
||||||
|
|
||||||
$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
|
$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
|
||||||
$title_site_url_linked = sprintf( __('Edit Site: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id( $id ), $site_url_no_http );
|
$title_site_url_linked = sprintf( __('Edit Site: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id( $id ), $site_url_no_http );
|
||||||
|
@ -155,7 +155,7 @@ if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
add_screen_option( 'per_page', array( 'label' => _x( 'Users', 'users per page (screen options)' ) ) );
|
add_screen_option( 'per_page' );
|
||||||
|
|
||||||
$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
|
$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
|
||||||
$title_site_url_linked = sprintf( __('Edit Site: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id( $id ), $site_url_no_http );
|
$title_site_url_linked = sprintf( __('Edit Site: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id( $id ), $site_url_no_http );
|
||||||
|
@ -22,7 +22,7 @@ $pagenum = $wp_list_table->get_pagenum();
|
|||||||
$title = __( 'Sites' );
|
$title = __( 'Sites' );
|
||||||
$parent_file = 'sites.php';
|
$parent_file = 'sites.php';
|
||||||
|
|
||||||
add_screen_option( 'per_page', array( 'label' => _x( 'Sites', 'sites per page (screen options)' ) ) );
|
add_screen_option( 'per_page' );
|
||||||
|
|
||||||
get_current_screen()->add_help_tab( array(
|
get_current_screen()->add_help_tab( array(
|
||||||
'id' => 'overview',
|
'id' => 'overview',
|
||||||
|
@ -220,7 +220,7 @@ $wp_list_table->prepare_items();
|
|||||||
|
|
||||||
add_thickbox();
|
add_thickbox();
|
||||||
|
|
||||||
add_screen_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' )) );
|
add_screen_option( 'per_page' );
|
||||||
|
|
||||||
get_current_screen()->add_help_tab( array(
|
get_current_screen()->add_help_tab( array(
|
||||||
'id' => 'overview',
|
'id' => 'overview',
|
||||||
|
@ -29,7 +29,7 @@ function confirm_delete_users( $users ) {
|
|||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<p><?php _e( 'You have chosen to delete the user from all networks and sites.' ); ?></p>
|
<p><?php _e( 'You have chosen to delete the user from all networks and sites.' ); ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<form action="users.php?action=dodelete" method="post">
|
<form action="users.php?action=dodelete" method="post">
|
||||||
<input type="hidden" name="dodelete" />
|
<input type="hidden" name="dodelete" />
|
||||||
<?php
|
<?php
|
||||||
@ -108,11 +108,11 @@ function confirm_delete_users( $users ) {
|
|||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<p><?php _e( 'Once you hit “Confirm Deletion”, the user will be permanently removed.' ); ?></p>
|
<p><?php _e( 'Once you hit “Confirm Deletion”, the user will be permanently removed.' ); ?></p>
|
||||||
<?php endif;
|
<?php endif;
|
||||||
|
|
||||||
submit_button( __('Confirm Deletion'), 'delete' );
|
submit_button( __('Confirm Deletion'), 'delete' );
|
||||||
?>
|
?>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,8 +136,8 @@ if ( isset( $_GET['action'] ) ) {
|
|||||||
echo '<div class="wrap">';
|
echo '<div class="wrap">';
|
||||||
confirm_delete_users( $_POST['allusers'] );
|
confirm_delete_users( $_POST['allusers'] );
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
require_once( ABSPATH . 'wp-admin/admin-footer.php' );
|
require_once( ABSPATH . 'wp-admin/admin-footer.php' );
|
||||||
} else {
|
} else {
|
||||||
wp_redirect( network_admin_url( 'users.php' ) );
|
wp_redirect( network_admin_url( 'users.php' ) );
|
||||||
}
|
}
|
||||||
exit();
|
exit();
|
||||||
@ -252,7 +252,7 @@ if ( $pagenum > $total_pages && $total_pages > 0 ) {
|
|||||||
$title = __( 'Users' );
|
$title = __( 'Users' );
|
||||||
$parent_file = 'users.php';
|
$parent_file = 'users.php';
|
||||||
|
|
||||||
add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
|
add_screen_option( 'per_page' );
|
||||||
|
|
||||||
get_current_screen()->add_help_tab( array(
|
get_current_screen()->add_help_tab( array(
|
||||||
'id' => 'overview',
|
'id' => 'overview',
|
||||||
|
@ -361,7 +361,7 @@ $wp_list_table->prepare_items();
|
|||||||
wp_enqueue_script('plugin-install');
|
wp_enqueue_script('plugin-install');
|
||||||
add_thickbox();
|
add_thickbox();
|
||||||
|
|
||||||
add_screen_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' ), 'default' => 999 ) );
|
add_screen_option( 'per_page', array( 'default' => 999 ) );
|
||||||
|
|
||||||
get_current_screen()->add_help_tab( array(
|
get_current_screen()->add_help_tab( array(
|
||||||
'id' => 'overview',
|
'id' => 'overview',
|
||||||
|
@ -173,7 +173,7 @@ $parent_file = 'upload.php';
|
|||||||
|
|
||||||
wp_enqueue_script( 'media' );
|
wp_enqueue_script( 'media' );
|
||||||
|
|
||||||
add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) );
|
add_screen_option( 'per_page' );
|
||||||
|
|
||||||
get_current_screen()->add_help_tab( array(
|
get_current_screen()->add_help_tab( array(
|
||||||
'id' => 'overview',
|
'id' => 'overview',
|
||||||
|
@ -17,7 +17,7 @@ $pagenum = $wp_list_table->get_pagenum();
|
|||||||
$title = __('Users');
|
$title = __('Users');
|
||||||
$parent_file = 'users.php';
|
$parent_file = 'users.php';
|
||||||
|
|
||||||
add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
|
add_screen_option( 'per_page' );
|
||||||
|
|
||||||
// contextual help - choose Help on the top right of admin panel to preview this.
|
// contextual help - choose Help on the top right of admin panel to preview this.
|
||||||
get_current_screen()->add_help_tab( array(
|
get_current_screen()->add_help_tab( array(
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.2-alpha-31695';
|
$wp_version = '4.2-alpha-31696';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user