Change Admin Pagination on Posts, Pages and Comments

One or the other users in the backend of WordPress find it quite disturbing that not more than 20 articles, pages and comments per page gets listed. Especially if you work with many tables and you have a fast connection, then an increased number of listed articles, pages, comments is useful. How to adapt and with a little CSS getting the best presentation I will show now, here are some tips.

As of WordPress version 2.8

With WordPress 2.8 comes a new value in the user's options for each page in the backend. This allows each user to extend the number of listed pages, articles and comments per page. If you like to solve it also in advance of WordPress 2.8, then the following syntax helps.
posts_per_page

Alternative Plugin

You should embed the syntax in a Plugin.
I am purposely not providing a Plugin, because the support of my existing solutions is already overwhelming. So it is rather as a basis for people who want to start here and as a memory for me when I need it again.
Some comments I have directly written down in the source code, so it is understandable. Also I do upload a CSS file, the content can be found at the end, which changes the design a little bit and create a better overview of the large number of entries.
posts_per_page2
// value for posts
define( 'FB_CAP_PER_POST', 100 );
// value for pages
define( 'FB_CAP_PER_PAGE', 100 );
// value for comments
define( 'FB_CAP_PER_COMMENT', 100 );

// only in admin area
if ( is_admin() ) {
 global $pagenow;
 
 if ( $pagenow == 'edit-pages.php' ) {
  add_filter( 'manage_pages_query', 'page_ChangeAdminPagination' );
  add_action( 'admin_print_styles', 'AddMyStylesheet' );
 }
 if ( $pagenow == 'edit.php' ) {
  add_action( 'admin_head', 'post_ChangeAdminPagination' );
  add_action( 'admin_print_styles', 'AddMyStylesheet' );
 }
 if ( $pagenow == 'edit-comments.php' )
  add_filter( 'comments_per_page', 'comment_ChangeAdminPagination' );
}
 
function post_ChangeAdminPagination() {
 global $wp_query;
 
 if ( $wp_query->query_vars[s] == '' ) {
  $per_post = (int) FB_CAP_PER_POST;
  $wp_query->query( 'showposts=' . $per_post );
 }
}

function page_ChangeAdminPagination($query) {
 global $per_page;
 
 $per_page = (int) FB_CAP_PER_PAGE;
 //$query['posts_per_page'] = $per_page;
 $query['posts_per_archive_page'] = $per_page;
 
 return $query;
}

function comment_ChangeAdminPagination($count) {

 $per_comment = (int) FB_CAP_PER_COMMENT;
 
 return $per_comment;
}

function AddMyStylesheet() {
 
  $myStyleFile = WP_PLUGIN_URL . '/change_admin_pagination/css/style.css';
  wp_register_style( 'change_admin_pagination', $myStyleFile );
  wp_enqueue_style( 'change_admin_pagination');
}
The following content is intended only to that area for editing the page or next to the entry contribution is shown. Thus, the line is smaller and has more entries available to view.
/**
 * style for smaller tables in admin of WordPress
 * @author Frank Bültge
 * @date 01.04.2009 20:51:59
 */
.post-title strong {
 float: left;
}

.row-actions {
 float: left;
 margin-left: 1% !important;
}

.check-column, tr td {
 padding-bottom: 0 !important;
}


.column-date {
 width: 15% !important;
}

td.date {
 font-size: .6em;
}

td.date abbr {
 float: right;
}

No comments:

Post a Comment