From f2208f3c91a03789282335413406fd9be763a5a5 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 10 Apr 2009 21:52:57 +0000 Subject: [PATCH] Add per page screen option for tags git-svn-id: http://svn.automattic.com/wordpress/trunk@10909 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-ajax.php | 1 + wp-admin/edit-tags.php | 10 +++++++--- wp-admin/includes/template.php | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index d8f91aa5db..ea9d4b00b3 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -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); diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index 89e1a161d1..c474f06484 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -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' => __('«'), 'next_text' => __('»'), - '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 ); ?> diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 592dd1dcf3..55356b1082 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -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 ''; }