Add per page screen option for categories

git-svn-id: https://develop.svn.wordpress.org/trunk@10908 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-04-10 21:47:01 +00:00
parent d957761a32
commit 5ff32a2dad
3 changed files with 11 additions and 4 deletions

View File

@ -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);

View File

@ -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' => __('&laquo;'),
'next_text' => __('&raquo;'),
'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>

View File

@ -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 '';
}