3 * WordPress Administration Screen API.
6 * @subpackage Administration
10 * Get the column headers for a screen
14 * @param string|WP_Screen $screen The screen you want the headers for
15 * @return array Containing the headers in the format id => UI String
17 function get_column_headers( $screen ) {
18 if ( is_string( $screen ) )
19 $screen = convert_to_screen( $screen );
21 static $column_headers = array();
23 if ( ! isset( $column_headers[ $screen->id ] ) )
24 $column_headers[ $screen->id ] = apply_filters( 'manage_' . $screen->id . '_columns', array() );
26 return $column_headers[ $screen->id ];
30 * Get a list of hidden columns.
34 * @param string|WP_Screen $screen The screen you want the hidden columns for
37 function get_hidden_columns( $screen ) {
38 if ( is_string( $screen ) )
39 $screen = convert_to_screen( $screen );
41 return (array) get_user_option( 'manage' . $screen->id . 'columnshidden' );
45 * Prints the meta box preferences for screen meta.
49 * @param string|WP_Screen $screen
51 function meta_box_prefs( $screen ) {
52 global $wp_meta_boxes;
54 if ( is_string( $screen ) )
55 $screen = convert_to_screen( $screen );
57 if ( empty($wp_meta_boxes[$screen->id]) )
60 $hidden = get_hidden_meta_boxes($screen);
62 foreach ( array_keys($wp_meta_boxes[$screen->id]) as $context ) {
63 foreach ( array_keys($wp_meta_boxes[$screen->id][$context]) as $priority ) {
64 foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) {
65 if ( false == $box || ! $box['title'] )
67 // Submit box cannot be hidden
68 if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] )
71 echo '<label for="' . $box_id . '-hide">';
72 echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />';
73 echo "{$box['title']}</label>\n";
80 * Get Hidden Meta Boxes
84 * @param string|WP_Screen $screen Screen identifier
85 * @return array Hidden Meta Boxes
87 function get_hidden_meta_boxes( $screen ) {
88 if ( is_string( $screen ) )
89 $screen = convert_to_screen( $screen );
91 $hidden = get_user_option( "metaboxhidden_{$screen->id}" );
93 $use_defaults = ! is_array( $hidden );
95 // Hide slug boxes by default
96 if ( $use_defaults ) {
98 if ( 'post' == $screen->base ) {
99 if ( 'post' == $screen->post_type || 'page' == $screen->post_type || 'attachment' == $screen->post_type )
100 $hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
102 $hidden = array( 'slugdiv' );
104 $hidden = apply_filters( 'default_hidden_meta_boxes', $hidden, $screen );
107 return apply_filters( 'hidden_meta_boxes', $hidden, $screen, $use_defaults );
111 * Register and configure an admin screen option
115 * @param string $option An option name.
116 * @param mixed $args Option-dependent arguments.
118 function add_screen_option( $option, $args = array() ) {
119 $current_screen = get_current_screen();
121 if ( ! $current_screen )
124 $current_screen->add_option( $option, $args );
128 * Displays a screen icon.
130 * @uses get_screen_icon()
133 * @param string|WP_Screen $screen Optional. Accepts a screen object (and defaults to the current screen object)
134 * which it uses to determine an icon HTML ID. Or, if a string is provided, it is used to form the icon HTML ID.
136 function screen_icon( $screen = '' ) {
137 echo get_screen_icon( $screen );
141 * Gets a screen icon.
146 * @param string|WP_Screen $screen Optional. Accepts a screen object (and defaults to the current screen object)
147 * which it uses to determine an icon HTML ID. Or, if a string is provided, it is used to form the icon HTML ID.
148 * @return string HTML for the screen icon.
150 function get_screen_icon( $screen = '' ) {
151 if ( empty( $screen ) )
152 $screen = get_current_screen();
153 elseif ( is_string( $screen ) )
158 if ( empty( $icon_id ) ) {
159 if ( ! empty( $screen->parent_base ) )
160 $icon_id = $screen->parent_base;
162 $icon_id = $screen->base;
164 if ( 'page' == $screen->post_type )
165 $icon_id = 'edit-pages';
167 if ( $screen->post_type )
168 $class .= ' ' . sanitize_html_class( 'icon32-posts-' . $screen->post_type );
171 return '<div id="icon-' . esc_attr( $icon_id ) . '" class="' . $class . '"><br /></div>';
175 * Get the current screen object
179 * @return WP_Screen Current screen object
181 function get_current_screen() {
182 global $current_screen;
184 if ( ! isset( $current_screen ) )
187 return $current_screen;
191 * Set the current screen object
194 * @uses $current_screen
196 * @param mixed $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen,
197 * or an existing screen object.
199 function set_current_screen( $hook_name = '' ) {
200 WP_Screen::get( $hook_name )->set_current_screen();
204 * A class representing the admin screen.
209 final class WP_Screen {
211 * Any action associated with the screen. 'add' for *-add.php and *-new.php screens. Empty otherwise.
220 * The base type of the screen. This is typically the same as $id but with any post types and taxonomies stripped.
221 * For example, for an $id of 'edit-post' the base is 'edit'.
230 * The number of columns to display. Access with get_columns().
236 private $columns = 0;
239 * The unique ID of the screen.
248 * Which admin the screen is in. network | user | site | false
257 * Whether the screen is in the network admin.
259 * Deprecated. Use in_admin() instead.
269 * Whether the screen is in the user admin.
271 * Deprecated. Use in_admin() instead.
281 * The base menu parent.
282 * This is derived from $parent_file by removing the query string and any .php extension.
283 * $parent_file values of 'edit.php?post_type=page' and 'edit.php?post_type=post' have a $parent_base of 'edit'.
292 * The parent_file for the screen per the admin menu system.
293 * Some $parent_file values are 'edit.php?post_type=page', 'edit.php', and 'options-general.php'.
302 * The post type associated with the screen, if any.
303 * The 'edit.php?post_type=page' screen has a post type of 'page'.
304 * The 'edit-tags.php?taxonomy=$taxonomy&post_type=page' screen has a post type of 'page'.
313 * The taxonomy associated with the screen, if any.
314 * The 'edit-tags.php?taxonomy=category' screen has a taxonomy of 'category'.
322 * The help tab data associated with the screen, if any.
328 private $_help_tabs = array();
331 * The help sidebar data associated with screen, if any.
337 private $_help_sidebar = '';
340 * Stores old string-based help.
342 private static $_old_compat_help = array();
345 * The screen options associated with screen, if any.
351 private $_options = array();
354 * The screen object registry.
360 private static $_registry = array();
363 * Stores the result of the public show_screen_options function.
369 private $_show_screen_options;
372 * Stores the 'screen_settings' section of screen options.
378 private $_screen_settings;
381 * Fetches a screen object.
386 * @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen.
387 * Defaults to the current $hook_suffix global.
388 * @return WP_Screen Screen object.
390 public static function get( $hook_name = '' ) {
392 if ( is_a( $hook_name, 'WP_Screen' ) )
395 $post_type = $taxonomy = null;
402 $id = $GLOBALS['hook_suffix'];
404 // For those pesky meta boxes.
405 if ( $hook_name && post_type_exists( $hook_name ) ) {
407 $id = 'post'; // changes later. ends up being $base.
409 if ( '.php' == substr( $id, -4 ) )
410 $id = substr( $id, 0, -4 );
412 if ( 'post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id ) {
413 $id = substr( $id, 0, -4 );
418 if ( ! $post_type && $hook_name ) {
419 if ( '-network' == substr( $id, -8 ) ) {
420 $id = substr( $id, 0, -8 );
421 $in_admin = 'network';
422 } elseif ( '-user' == substr( $id, -5 ) ) {
423 $id = substr( $id, 0, -5 );
427 $id = sanitize_key( $id );
428 if ( 'edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr( $id, 0, 5 ) ) {
429 $maybe = substr( $id, 5 );
430 if ( taxonomy_exists( $maybe ) ) {
433 } elseif ( post_type_exists( $maybe ) ) {
442 if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN )
443 $in_admin = 'network';
444 elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN )
450 if ( 'index' == $id )
452 elseif ( 'front' == $id )
457 // If this is the current screen, see if we can be more accurate for post types and taxonomies.
458 if ( ! $hook_name ) {
459 if ( isset( $_REQUEST['post_type'] ) )
460 $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false;
461 if ( isset( $_REQUEST['taxonomy'] ) )
462 $taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false;
466 if ( isset( $_GET['post'] ) )
467 $post_id = (int) $_GET['post'];
468 elseif ( isset( $_POST['post_ID'] ) )
469 $post_id = (int) $_POST['post_ID'];
474 $post = get_post( $post_id );
476 $post_type = $post->post_type;
480 if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) )
488 if ( null === $post_type )
493 if ( null === $post_type )
495 $id .= '-' . $post_type;
498 if ( null === $taxonomy )
499 $taxonomy = 'post_tag';
500 // The edit-tags ID does not contain the post type. Look for it in the request.
501 if ( null === $post_type ) {
503 if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) )
504 $post_type = $_REQUEST['post_type'];
507 $id = 'edit-' . $taxonomy;
511 if ( 'network' == $in_admin ) {
514 } elseif ( 'user' == $in_admin ) {
519 if ( isset( self::$_registry[ $id ] ) ) {
520 $screen = self::$_registry[ $id ];
521 if ( $screen === get_current_screen() )
524 $screen = new WP_Screen();
528 $screen->base = $base;
529 $screen->action = $action;
530 $screen->post_type = (string) $post_type;
531 $screen->taxonomy = (string) $taxonomy;
532 $screen->is_user = ( 'user' == $in_admin );
533 $screen->is_network = ( 'network' == $in_admin );
534 $screen->in_admin = $in_admin;
536 self::$_registry[ $id ] = $screen;
542 * Makes the screen object the current screen.
544 * @see set_current_screen()
547 function set_current_screen() {
548 global $current_screen, $taxnow, $typenow;
549 $current_screen = $this;
550 $taxnow = $this->taxonomy;
551 $typenow = $this->post_type;
552 do_action( 'current_screen', $current_screen );
561 private function __construct() {}
564 * Indicates whether the screen is in a particular admin
568 * @param string $admin The admin to check against (network | user | site).
569 * If empty any of the three admins will result in true.
570 * @return boolean True if the screen is in the indicated admin, false otherwise.
573 public function in_admin( $admin = null ) {
574 if ( empty( $admin ) )
575 return (bool) $this->in_admin;
577 return ( $admin == $this->in_admin );
581 * Sets the old string-based contextual help for the screen.
583 * For backwards compatibility.
587 * @param WP_Screen $screen A screen object.
588 * @param string $help Help text.
590 static function add_old_compat_help( $screen, $help ) {
591 self::$_old_compat_help[ $screen->id ] = $help;
595 * Set the parent information for the screen.
596 * This is called in admin-header.php after the menu parent for the screen has been determined.
600 * @param string $parent_file The parent file of the screen. Typically the $parent_file global.
602 function set_parentage( $parent_file ) {
603 $this->parent_file = $parent_file;
604 list( $this->parent_base ) = explode( '?', $parent_file );
605 $this->parent_base = str_replace( '.php', '', $this->parent_base );
609 * Adds an option for the screen.
610 * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add screen options.
614 * @param string $option Option ID
615 * @param mixed $args Option-dependent arguments.
617 public function add_option( $option, $args = array() ) {
618 $this->_options[ $option ] = $args;
622 * Gets the arguments for an option for the screen.
626 * @param string $option Option ID.
627 * @param mixed $key Optional. Specific array key for when the option is an array.
629 public function get_option( $option, $key = false ) {
630 if ( ! isset( $this->_options[ $option ] ) )
633 if ( isset( $this->_options[ $option ][ $key ] ) )
634 return $this->_options[ $option ][ $key ];
637 return $this->_options[ $option ];
641 * Gets the help tabs registered for the screen.
645 * @return array Help tabs with arguments.
647 public function get_help_tabs() {
648 return $this->_help_tabs;
652 * Gets the arguments for a help tab.
656 * @param string $id Help Tab ID.
657 * @return array Help tab arguments.
659 public function get_help_tab( $id ) {
660 if ( ! isset( $this->_help_tabs[ $id ] ) )
662 return $this->_help_tabs[ $id ];
666 * Add a help tab to the contextual help for the screen.
667 * Call this on the load-$pagenow hook for the relevant screen.
672 * - string - title - Title for the tab.
673 * - string - id - Tab ID. Must be HTML-safe.
674 * - string - content - Help tab content in plain text or HTML. Optional.
675 * - callback - callback - A callback to generate the tab content. Optional.
678 public function add_help_tab( $args ) {
685 $args = wp_parse_args( $args, $defaults );
687 $args['id'] = sanitize_html_class( $args['id'] );
689 // Ensure we have an ID and title.
690 if ( ! $args['id'] || ! $args['title'] )
693 // Allows for overriding an existing tab with that ID.
694 $this->_help_tabs[ $args['id'] ] = $args;
698 * Removes a help tab from the contextual help for the screen.
702 * @param string $id The help tab ID.
704 public function remove_help_tab( $id ) {
705 unset( $this->_help_tabs[ $id ] );
709 * Removes all help tabs from the contextual help for the screen.
713 public function remove_help_tabs() {
714 $this->_help_tabs = array();
718 * Gets the content from a contextual help sidebar.
722 * @return string Contents of the help sidebar.
724 public function get_help_sidebar() {
725 return $this->_help_sidebar;
729 * Add a sidebar to the contextual help for the screen.
730 * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add a sidebar to the contextual help.
734 * @param string $content Sidebar content in plain text or HTML.
736 public function set_help_sidebar( $content ) {
737 $this->_help_sidebar = $content;
741 * Gets the number of layout columns the user has selected.
743 * The layout_columns option controls the max number and default number of
744 * columns. This method returns the number of columns within that range selected
745 * by the user via Screen Options. If no selection has been made, the default
746 * provisioned in layout_columns is returned. If the screen does not support
747 * selecting the number of layout columns, 0 is returned.
751 * @return int Number of columns to display.
753 public function get_columns() {
754 return $this->columns;
758 * Render the screen's help section.
760 * This will trigger the deprecated filters for backwards compatibility.
764 public function render_screen_meta() {
766 // Call old contextual_help_list filter.
767 self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this );
769 $old_help = isset( self::$_old_compat_help[ $this->id ] ) ? self::$_old_compat_help[ $this->id ] : '';
770 $old_help = apply_filters( 'contextual_help', $old_help, $this->id, $this );
772 // Default help only if there is no old-style block of text and no new-style help tabs.
773 if ( empty( $old_help ) && ! $this->get_help_tabs() ) {
774 $default_help = apply_filters( 'default_contextual_help', '' );
776 $old_help = '<p>' . $default_help . '</p>';
780 $this->add_help_tab( array(
781 'id' => 'old-contextual-help',
782 'title' => __('Overview'),
783 'content' => $old_help,
787 $help_sidebar = $this->get_help_sidebar();
789 $help_class = 'hidden';
790 if ( ! $help_sidebar )
791 $help_class .= ' no-sidebar';
795 <div id="screen-meta" class="metabox-prefs">
797 <div id="contextual-help-wrap" class="<?php echo esc_attr( $help_class ); ?>" tabindex="-1" aria-label="<?php esc_attr_e('Contextual Help Tab'); ?>">
798 <div id="contextual-help-back"></div>
799 <div id="contextual-help-columns">
800 <div class="contextual-help-tabs">
803 $class = ' class="active"';
804 foreach ( $this->get_help_tabs() as $tab ) :
805 $link_id = "tab-link-{$tab['id']}";
806 $panel_id = "tab-panel-{$tab['id']}";
809 <li id="<?php echo esc_attr( $link_id ); ?>"<?php echo $class; ?>>
810 <a href="<?php echo esc_url( "#$panel_id" ); ?>" aria-controls="<?php echo esc_attr( $panel_id ); ?>">
811 <?php echo esc_html( $tab['title'] ); ?>
821 <?php if ( $help_sidebar ) : ?>
822 <div class="contextual-help-sidebar">
823 <?php echo $help_sidebar; ?>
827 <div class="contextual-help-tabs-wrap">
829 $classes = 'help-tab-content active';
830 foreach ( $this->get_help_tabs() as $tab ):
831 $panel_id = "tab-panel-{$tab['id']}";
834 <div id="<?php echo esc_attr( $panel_id ); ?>" class="<?php echo $classes; ?>">
836 // Print tab content.
837 echo $tab['content'];
839 // If it exists, fire tab callback.
840 if ( ! empty( $tab['callback'] ) )
841 call_user_func_array( $tab['callback'], array( $this, $tab ) );
845 $classes = 'help-tab-content';
852 // Setup layout columns
854 // Back compat for plugins using the filter instead of add_screen_option()
855 $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this );
857 if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) )
858 $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) );
860 if ( $this->get_option( 'layout_columns' ) ) {
861 $this->columns = (int) get_user_option("screen_layout_$this->id");
863 if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) )
864 $this->columns = $this->get_option( 'layout_columns', 'default' );
866 $GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat.
868 // Add screen options
869 if ( $this->show_screen_options() )
870 $this->render_screen_options();
874 if ( ! $this->get_help_tabs() && ! $this->show_screen_options() )
877 <div id="screen-meta-links">
878 <?php if ( $this->get_help_tabs() ) : ?>
879 <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">
880 <a href="#contextual-help-wrap" id="contextual-help-link" class="show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e( 'Help' ); ?></a>
883 if ( $this->show_screen_options() ) : ?>
884 <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
885 <a href="#screen-options-wrap" id="show-settings-link" class="show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e( 'Screen Options' ); ?></a>
892 public function show_screen_options() {
893 global $wp_meta_boxes;
895 if ( is_bool( $this->_show_screen_options ) )
896 return $this->_show_screen_options;
898 $columns = get_column_headers( $this );
900 $show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' );
902 switch ( $this->id ) {
904 $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
907 $this->_screen_settings = '';
911 $this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this );
913 if ( $this->_screen_settings || $this->_options )
916 $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this );
917 return $this->_show_screen_options;
921 * Render the screen options tab.
925 public function render_screen_options() {
926 global $wp_meta_boxes, $wp_list_table;
928 $columns = get_column_headers( $this );
929 $hidden = get_hidden_columns( $this );
933 <div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php esc_attr_e('Screen Options Tab'); ?>">
934 <form id="adv-settings" action="" method="post">
935 <?php if ( isset( $wp_meta_boxes[ $this->id ] ) || $this->get_option( 'per_page' ) || ( $columns && empty( $columns['_title'] ) ) ) : ?>
936 <h5><?php _e( 'Show on screen' ); ?></h5>
940 if ( isset( $wp_meta_boxes[ $this->id ] ) ) : ?>
941 <div class="metabox-prefs">
943 meta_box_prefs( $this );
945 if ( 'dashboard' === $this->id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) {
946 if ( isset( $_GET['welcome'] ) ) {
947 $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1;
948 update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked );
950 $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
951 if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) )
952 $welcome_checked = false;
954 echo '<label for="wp_welcome_panel-hide">';
955 echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />';
956 echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n";
963 if ( ! empty( $columns['_title'] ) ) : ?>
964 <h5><?php echo $columns['_title']; ?></h5>
966 <div class="metabox-prefs">
968 $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname');
970 foreach ( $columns as $column => $title ) {
971 // Can't hide these for they are special
972 if ( in_array( $column, $special ) )
974 if ( empty( $title ) )
977 if ( 'comments' == $column )
978 $title = __( 'Comments' );
979 $id = "$column-hide";
980 echo '<label for="' . $id . '">';
981 echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />';
982 echo "$title</label>\n";
989 $this->render_screen_layout();
990 $this->render_per_page_options();
991 echo $this->_screen_settings;
994 <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>
1001 * Render the option for number of columns on the page
1005 function render_screen_layout() {
1006 if ( ! $this->get_option('layout_columns') )
1009 $screen_layout_columns = $this->get_columns();
1010 $num = $this->get_option( 'layout_columns', 'max' );
1013 <h5 class="screen-layout"><?php _e('Screen Layout'); ?></h5>
1014 <div class='columns-prefs'><?php
1015 _e('Number of Columns:');
1016 for ( $i = 1; $i <= $num; ++$i ):
1018 <label class="columns-prefs-<?php echo $i; ?>">
1019 <input type='radio' name='screen_columns' value='<?php echo esc_attr( $i ); ?>'
1020 <?php checked( $screen_layout_columns, $i ); ?> />
1021 <?php echo esc_html( $i ); ?>
1030 * Render the items per page option
1034 function render_per_page_options() {
1035 if ( ! $this->get_option( 'per_page' ) )
1038 $per_page_label = $this->get_option( 'per_page', 'label' );
1040 $option = $this->get_option( 'per_page', 'option' );
1042 $option = str_replace( '-', '_', "{$this->id}_per_page" );
1044 $per_page = (int) get_user_option( $option );
1045 if ( empty( $per_page ) || $per_page < 1 ) {
1046 $per_page = $this->get_option( 'per_page', 'default' );
1051 if ( 'edit_comments_per_page' == $option ) {
1052 $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
1053 $per_page = apply_filters( 'comments_per_page', $per_page, $comment_status );
1054 } elseif ( 'categories_per_page' == $option ) {
1055 $per_page = apply_filters( 'edit_categories_per_page', $per_page );
1057 $per_page = apply_filters( $option, $per_page );
1061 if ( isset( $this->post_type ) )
1062 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type );
1065 <div class="screen-options">
1066 <?php if ( $per_page_label ) : ?>
1067 <input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]"
1068 id="<?php echo esc_attr( $option ); ?>" maxlength="3"
1069 value="<?php echo esc_attr( $per_page ); ?>" />
1070 <label for="<?php echo esc_attr( $option ); ?>">
1071 <?php echo esc_html( $per_page_label ); ?>
1075 echo get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ); ?>
1076 <input type='hidden' name='wp_screen_options[option]' value='<?php echo esc_attr($option); ?>' />