Add per page screen option for tags

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

View File

@ -1041,6 +1041,7 @@ case 'set-screen-option':
case 'edit_comments_per_page':
case 'upload_per_page':
case 'categories_per_page':
case 'edit_tags_per_page':
$value = (int) $value;
if ( $value < 1 || $value > 999 )
die(-1);

View File

@ -177,14 +177,18 @@ $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
if ( empty($pagenum) )
$pagenum = 1;
$tagsperpage = apply_filters("tagsperpage",20);
$tags_per_page = get_user_option('edit_tags_per_page');
if ( empty($tags_per_page) )
$tags_per_page = 20;
$tags_per_page = apply_filters('edit_tags_per_page', $tags_per_page);
$tags_per_page = apply_filters('tagsperpage', $tags_per_page); // Old filter
$page_links = paginate_links( array(
'base' => add_query_arg( 'pagenum', '%#%' ),
'format' => '',
'prev_text' => __('&laquo;'),
'next_text' => __('&raquo;'),
'total' => ceil(wp_count_terms($taxonomy) / $tagsperpage),
'total' => ceil(wp_count_terms($taxonomy) / $tags_per_page),
'current' => $pagenum
));
@ -224,7 +228,7 @@ if ( $page_links )
$searchterms = isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '';
$count = tag_rows( $pagenum, $tagsperpage, $searchterms, $taxonomy );
$count = tag_rows( $pagenum, $tags_per_page, $searchterms, $taxonomy );
?>
</tbody>
</table>

View File

@ -3526,6 +3526,9 @@ function screen_options($screen) {
case 'categories':
$per_page_label = __('Categories per page:');
break;
case 'edit-tags':
$per_page_label = __('Tags per page:');
break;
default:
return '';
}