fix pagination
This commit is contained in:
parent
0f356acee8
commit
a6657edd4a
1 changed files with 6 additions and 5 deletions
|
@ -67,12 +67,12 @@ class Migrate_List extends \WP_List_Table {
|
||||||
$sortable = $this->get_sortable_columns();
|
$sortable = $this->get_sortable_columns();
|
||||||
$this->_column_headers = array( $columns, $hidden, $sortable );
|
$this->_column_headers = array( $columns, $hidden, $sortable );
|
||||||
|
|
||||||
$this->items = array();
|
$items = array();
|
||||||
$this->process_action();
|
$this->process_action();
|
||||||
if ( 'activitypub_tools' === $_REQUEST['page'] ) {
|
if ( 'activitypub_tools' === $_REQUEST['page'] ) {
|
||||||
if ( isset( $_REQUEST['comments'] ) && 'activitypub' === $_REQUEST['comments'] ) {
|
if ( isset( $_REQUEST['comments'] ) && 'activitypub' === $_REQUEST['comments'] ) {
|
||||||
foreach ( \Activitypub\Tools\Posts::get_posts_with_activitypub_comments() as $ap_post ) {
|
foreach ( \Activitypub\Tools\Posts::get_posts_with_activitypub_comments() as $ap_post ) {
|
||||||
$this->items[] = array(
|
$items[] = array(
|
||||||
'post_author' => $ap_post->post_author,
|
'post_author' => $ap_post->post_author,
|
||||||
'title' => \sprintf(
|
'title' => \sprintf(
|
||||||
'<a href="%1s">%2s</a>',
|
'<a href="%1s">%2s</a>',
|
||||||
|
@ -86,7 +86,7 @@ class Migrate_List extends \WP_List_Table {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ( \Activitypub\Tools\Posts::get_posts_to_migrate() as $post ) {
|
foreach ( \Activitypub\Tools\Posts::get_posts_to_migrate() as $post ) {
|
||||||
$this->items[] = array(
|
$items[] = array(
|
||||||
'post_author' => $post->post_author,
|
'post_author' => $post->post_author,
|
||||||
'title' => \sprintf(
|
'title' => \sprintf(
|
||||||
'<a href="%1s">%2s</a>',
|
'<a href="%1s">%2s</a>',
|
||||||
|
@ -104,8 +104,8 @@ class Migrate_List extends \WP_List_Table {
|
||||||
// pagination
|
// pagination
|
||||||
$per_page = $this->get_items_per_page( 'elements_per_page', 10 );
|
$per_page = $this->get_items_per_page( 'elements_per_page', 10 );
|
||||||
$current_page = $this->get_pagenum();
|
$current_page = $this->get_pagenum();
|
||||||
$total_items = count( $this->items );
|
$total_items = count( $items );
|
||||||
$table_data = array_slice( $this->items, ( ( $current_page - 1 ) * $per_page ), $per_page );
|
$table_data = array_slice( $items, ( ( $current_page - 1 ) * $per_page ), $per_page );
|
||||||
$this->set_pagination_args(
|
$this->set_pagination_args(
|
||||||
array(
|
array(
|
||||||
'total_items' => $total_items,
|
'total_items' => $total_items,
|
||||||
|
@ -113,6 +113,7 @@ class Migrate_List extends \WP_List_Table {
|
||||||
'total_pages' => ceil( $total_items / $per_page ),
|
'total_pages' => ceil( $total_items / $per_page ),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
$this->items = $table_data;
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
if ( isset( $_REQUEST['_wpnonce'] ) ) {
|
if ( isset( $_REQUEST['_wpnonce'] ) ) {
|
||||||
|
|
Loading…
Reference in a new issue