Add per page screen option for tags

git-svn-id: http://svn.automattic.com/wordpress/trunk@10909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-04-10 21:52:57 +00:00
parent 1164645872
commit f2208f3c91
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 'edit_comments_per_page':
case 'upload_per_page': case 'upload_per_page':
case 'categories_per_page': case 'categories_per_page':
case 'edit_tags_per_page':
$value = (int) $value; $value = (int) $value;
if ( $value < 1 || $value > 999 ) if ( $value < 1 || $value > 999 )
die(-1); die(-1);

View File

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

View File

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