set_pagination_args example

$not_in = array_merge( array_values( $_REQUEST['post__not_in'] )$not_in );
        }

        if ( ! empty( $not_in ) ) {
            $_REQUEST['post__not_in'] = $not_in;
        }

        list( $post_mime_types$avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST );

        $this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' === $_REQUEST['attachment-filter'];

        $this->set_pagination_args(
            array(
                'total_items' => $wp_query->found_posts,
                'total_pages' => $wp_query->max_num_pages,
                'per_page'    => $wp_query->query_vars['posts_per_page'],
            )
        );
        if ( $wp_query->posts ) {
            update_post_thumbnail_cache( $wp_query );
            update_post_parent_caches( $wp_query->posts );
        }
    }

    
$total_comments = get_comments(
            array_merge(
                $args,
                array(
                    'count'  => true,
                    'offset' => 0,
                    'number' => 0,
                )
            )
        );

        $this->set_pagination_args(
            array(
                'total_items' => $total_comments,
                'per_page'    => $comments_per_page,
            )
        );
    }

    /** * @param string $comment_status * @return int */
    


        $requests_query = new WP_Query( $args );
        $requests       = $requests_query->posts;

        foreach ( $requests as $request ) {
            $this->items[] = wp_get_user_request( $request->ID );
        }

        $this->items = array_filter( $this->items );

        $this->set_pagination_args(
            array(
                'total_items' => $requests_query->found_posts,
                'per_page'    => $posts_per_page,
            )
        );
    }

    /** * Returns the markup for the Checkbox column. * * @since 4.9.6 * * @param WP_User_Request $item Item being shown. * @return string Checkbox column markup. */
$total_sites = get_sites(
            array_merge(
                $args,
                array(
                    'count'  => true,
                    'offset' => 0,
                    'number' => 0,
                )
            )
        );

        $this->set_pagination_args(
            array(
                'total_items' => $total_sites,
                'per_page'    => $per_page,
            )
        );
    }

    /** */
    public function no_items() {
        _e( 'No sites found.' );
    }
 else {
                uasort( $this->items, array( $this, '_order_callback' ) );
            }
        }

        $start = ( $page - 1 ) * $themes_per_page;

        if ( $total_this_page > $themes_per_page ) {
            $this->items = array_slice( $this->items, $start$themes_per_page, true );
        }

        $this->set_pagination_args(
            array(
                'total_items' => $total_this_page,
                'per_page'    => $themes_per_page,
            )
        );
    }

    /** * @param WP_Theme $theme * @return bool */
    

        $args = apply_filters( 'users_list_table_query_args', $args );

        // Query the user IDs for this page.         $wp_user_search = new WP_User_Query( $args );

        $this->items = $wp_user_search->get_results();

        $this->set_pagination_args(
            array(
                'total_items' => $wp_user_search->get_total(),
                'per_page'    => $users_per_page,
            )
        );
    }

    /** * Outputs 'no users' message. * * @since 3.1.0 */
if ( is_wp_error( $api ) ) {
            $this->error = $api;
            return;
        }

        $this->items = $api->plugins;

        if ( $this->orderby ) {
            uasort( $this->items, array( $this, 'order_callback' ) );
        }

        $this->set_pagination_args(
            array(
                'total_items' => $api->info['results'],
                'per_page'    => $args['per_page'],
            )
        );

        if ( isset( $api->info['groups'] ) ) {
            $this->groups = $api->info['groups'];
        }

        if ( $installed_plugins ) {
            
// Save the values because 'number' and 'offset' can be subsequently overridden.         $this->callback_args = $args;

        if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
            // We'll need the full set of terms then.             $args['number'] = 0;
            $args['offset'] = $args['number'];
        }

        $this->items = get_terms( $args );

        $this->set_pagination_args(
            array(
                'total_items' => wp_count_terms(
                    array(
                        'taxonomy' => $taxonomy,
                        'search'   => $search,
                    )
                ),
                'per_page'    => $tags_per_page,
            )
        );
    }

    
unset( $themes[ get_option( 'stylesheet' ) ] );
        WP_Theme::sort_by_name( $themes );

        $per_page = 36;
        $page     = $this->get_pagenum();

        $start = ( $page - 1 ) * $per_page;

        $this->items = array_slice( $themes$start$per_page, true );

        $this->set_pagination_args(
            array(
                'total_items'     => count( $themes ),
                'per_page'        => $per_page,
                'infinite_scroll' => true,
            )
        );
    }

    /** */
    public function no_items() {
        
return;
        }

        $api = themes_api( 'query_themes', $args );

        if ( is_wp_error( $api ) ) {
            wp_die( '<p>' . $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try Again' ) . '</a></p>' );
        }

        $this->items = $api->themes;

        $this->set_pagination_args(
            array(
                'total_items'     => $api->info['results'],
                'per_page'        => $args['per_page'],
                'infinite_scroll' => true,
            )
        );
    }

    /** */
    public function no_items() {
        
$args['order'] = $_REQUEST['order'];
        }

        /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
        $args = apply_filters( 'users_list_table_query_args', $args );

        // Query the user IDs for this page.         $wp_user_search = new WP_User_Query( $args );

        $this->items = $wp_user_search->get_results();

        $this->set_pagination_args(
            array(
                'total_items' => $wp_user_search->get_total(),
                'per_page'    => $users_per_page,
            )
        );
    }

    /** * @return array */
    protected function get_bulk_actions() {
        
$total_items = array_sum( $post_counts );

                // Subtract post types that are not included in the admin all list.                 foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) {
                    $total_items -= $post_counts[ $state ];
                }
            }
        }

        $this->is_trash = isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'];

        $this->set_pagination_args(
            array(
                'total_items' => $total_items,
                'per_page'    => $per_page,
            )
        );
    }

    /** * @return bool */
    public function has_items() {
        
uasort( $this->items, array( $this, '_order_callback' ) );

        $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 );

        $start = ( $page - 1 ) * $plugins_per_page;

        if ( $total_this_page > $plugins_per_page ) {
            $this->items = array_slice( $this->items, $start$plugins_per_page );
        }

        $this->set_pagination_args(
            array(
                'total_items' => $total_this_page,
                'per_page'    => $plugins_per_page,
            )
        );
    }

    /** * @global string $s URL encoded search term. * * @param array $plugin * @return bool */
Home | Imprint | This part of the site doesn't use cookies.