mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Add per page screen option for categories
git-svn-id: http://svn.automattic.com/wordpress/trunk@10908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c827471bf0
commit
1164645872
@ -1040,6 +1040,7 @@ case 'set-screen-option':
|
||||
case 'edit_pages_per_page':
|
||||
case 'edit_comments_per_page':
|
||||
case 'upload_per_page':
|
||||
case 'categories_per_page':
|
||||
$value = (int) $value;
|
||||
if ( $value < 1 || $value > 999 )
|
||||
die(-1);
|
||||
|
@ -160,15 +160,18 @@ endif; ?>
|
||||
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
|
||||
if ( empty($pagenum) )
|
||||
$pagenum = 1;
|
||||
if( ! isset( $catsperpage ) || $catsperpage < 0 )
|
||||
$catsperpage = 20;
|
||||
|
||||
$cats_per_page = get_user_option('categories_per_page');
|
||||
if ( empty($cats_per_page) )
|
||||
$cats_per_page = 20;
|
||||
$cats_per_page = apply_filters('edit_categories_per_page', $cats_per_page);
|
||||
|
||||
$page_links = paginate_links( array(
|
||||
'base' => add_query_arg( 'pagenum', '%#%' ),
|
||||
'format' => '',
|
||||
'prev_text' => __('«'),
|
||||
'next_text' => __('»'),
|
||||
'total' => ceil(wp_count_terms('category') / $catsperpage),
|
||||
'total' => ceil(wp_count_terms('category') / $cats_per_page),
|
||||
'current' => $pagenum
|
||||
));
|
||||
|
||||
@ -205,7 +208,7 @@ if ( $page_links )
|
||||
|
||||
<tbody id="the-list" class="list:cat">
|
||||
<?php
|
||||
cat_rows(0, 0, 0, $pagenum, $catsperpage);
|
||||
cat_rows(0, 0, 0, $pagenum, $cats_per_page);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -3523,6 +3523,9 @@ function screen_options($screen) {
|
||||
case 'upload':
|
||||
$per_page_label = __('Media items per page:');
|
||||
break;
|
||||
case 'categories':
|
||||
$per_page_label = __('Categories per page:');
|
||||
break;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user