get_pagenum example



/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'activate_plugins' ) ) {
    wp_die( __( 'Sorry, you are not allowed to manage plugins for this site.' ) );
}

$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
$pagenum       = $wp_list_table->get_pagenum();

$action = $wp_list_table->current_action();

$plugin = isset( $_REQUEST['plugin'] ) ? wp_unslash( $_REQUEST['plugin'] ) : '';
$s      = isset( $_REQUEST['s'] ) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : '';

// Clean up request URI from temporary args for screen options/paging uri's to work as expected. $query_args_to_remove = array(
    'error',
    'deleted',
    'activate',
    


/** Load WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'manage_network_themes' ) ) {
    wp_die( __( 'Sorry, you are not allowed to manage network themes.' ) );
}

$wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
$pagenum       = $wp_list_table->get_pagenum();

$action = $wp_list_table->current_action();

$s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';

// Clean up request URI from temporary args for screen options/paging uri's to work as expected. $temp_args = array(
    'enabled',
    'disabled',
    'deleted',
    'error',
    

            ?> </p> </div> </div> <?php     require_once ABSPATH . 'wp-admin/admin-footer.php';
    exit;
}

$wp_list_table = _get_list_table( 'WP_Media_List_Table' );
$pagenum       = $wp_list_table->get_pagenum();

// Handle bulk actions. $doaction = $wp_list_table->current_action();

if ( $doaction ) {
    check_admin_referer( 'bulk-media' );

    $post_ids = array();

    if ( 'delete_all' === $doaction ) {
        $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
        
array(
                'plural' => 'themes',
                'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
            )
        );

        $status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all';
        if ( ! in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken', 'auto-update-enabled', 'auto-update-disabled' ), true ) ) {
            $status = 'all';
        }

        $page = $this->get_pagenum();

        $this->is_site_themes = ( 'site-themes-network' === $this->screen->id ) ? true : false;

        if ( $this->is_site_themes ) {
            $this->site_id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0;
        }

        $this->show_autoupdates = wp_is_auto_update_enabled_for_type( 'theme' ) &&
            ! $this->is_site_themes && current_user_can( 'update_themes' );
    }

    
'total_items' => 0,
                'total_pages' => 0,
                'per_page'    => 0,
            )
        );

        if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
            $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
        }

        // Redirect if page number is invalid and headers are not already sent.         if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
            wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
            exit;
        }

        $this->_pagination_args = $args;
    }

    /** * Access the pagination args. * * @since 3.1.0 * * @param string $key Pagination argument to retrieve. Common values include 'total_items', * 'total_pages', 'per_page', or 'infinite_scroll'. * @return int Number of items that correspond to the given pagination argument. */


if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {
    wp_die(
        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
        '<p>' . __( 'Sorry, you are not allowed to edit posts in this post type.' ) . '</p>',
        403
    );
}

$wp_list_table = _get_list_table( 'WP_Posts_List_Table' );
$pagenum       = $wp_list_table->get_pagenum();

// Back-compat for viewing comments of an entry. foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) {
    if ( ! empty( $_REQUEST[ $_redirect ] ) ) {
        wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) );
        exit;
    }
}
unset( $_redirect );

if ( 'post' !== $post_type ) {
    
$search_terms  = array();
        $search_string = '';
        if ( ! empty( $_REQUEST['s'] ) ) {
            $search_string = strtolower( wp_unslash( $_REQUEST['s'] ) );
            $search_terms  = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) );
        }

        if ( ! empty( $_REQUEST['features'] ) ) {
            $this->features = $_REQUEST['features'];
        }

        $paged = $this->get_pagenum();

        $per_page = 36;

        // These are the tabs which are shown on the page,         $tabs              = array();
        $tabs['dashboard'] = __( 'Search' );
        if ( 'search' === $tab ) {
            $tabs['search'] = __( 'Search Results' );
        }
        $tabs['upload']   = __( 'Upload' );
        $tabs['featured'] = _x( 'Featured', 'themes' );
        

}

/** * $post_type is set when the WP_Terms_List_Table instance is created * * @global string $post_type */
global $post_type;

$wp_list_table = _get_list_table( 'WP_Terms_List_Table' );
$pagenum       = $wp_list_table->get_pagenum();

$title = $tax->labels->name;

if ( 'post' !== $post_type ) {
    $parent_file  = ( 'attachment' === $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type";
    $submenu_file = "edit-tags.php?taxonomy=$taxonomy&amp;post_type=$post_type";
} elseif ( 'link_category' === $tax->name ) {
    $parent_file  = 'link-manager.php';
    $submenu_file = 'edit-tags.php?taxonomy=link_category';
} else {
    $parent_file  = 'edit.php';
    
if ( ! current_user_can( 'install_plugins' ) ) {
    wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
}

if ( is_multisite() && ! is_network_admin() ) {
    wp_redirect( network_admin_url( 'plugin-install.php' ) );
    exit;
}

$wp_list_table = _get_list_table( 'WP_Plugin_Install_List_Table' );
$pagenum       = $wp_list_table->get_pagenum();

if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
    $location = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );

    if ( ! empty( $_REQUEST['paged'] ) ) {
        $location = add_query_arg( 'paged', (int) $_REQUEST['paged']$location );
    }

    wp_redirect( $location );
    exit;
}


    public function prepare_items() {
        require_once ABSPATH . 'wp-admin/includes/plugin-install.php';

        global $tabs$tab$paged$type$term;

        wp_reset_vars( array( 'tab' ) );

        $paged = $this->get_pagenum();

        $per_page = 36;

        // These are the tabs which are shown on the page.         $tabs = array();

        if ( 'search' === $tab ) {
            $tabs['search'] = __( 'Search Results' );
        }

        if ( 'beta' === $tab || str_contains( get_bloginfo( 'version' ), '-' ) ) {
            
&& 'menu_order title' === $wp_query->query['orderby']
        );

        $post_type = $this->screen->post_type;
        $per_page  = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );

        /** This filter is documented in wp-admin/includes/post.php */
        $per_page = apply_filters( 'edit_posts_per_page', $per_page$post_type );

        if ( $this->hierarchical_display ) {
            $total_items = $wp_query->post_count;
        } elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) {
            $total_items = $wp_query->found_posts;
        } else {
            $post_counts = (array) wp_count_posts( $post_type, 'readable' );

            if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status']$avail_post_stati, true ) ) {
                $total_items = $post_counts[ $_REQUEST['post_status'] ];
            } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) {
                $total_items = $this->sticky_posts_count;
            } elseif ( isset( $_GET['author'] ) && get_current_user_id() === (int) $_GET['author'] ) {
                $total_items = $this->user_posts_count;
            } else {
                
'updated' => 'true',
                        'action'  => $deletefunction,
                    ),
                    network_admin_url( 'users.php' )
                )
            );
            exit;
    }
}

$wp_list_table = _get_list_table( 'WP_MS_Users_List_Table' );
$pagenum       = $wp_list_table->get_pagenum();
$wp_list_table->prepare_items();
$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );

if ( $pagenum > $total_pages && $total_pages > 0 ) {
    wp_redirect( add_query_arg( 'paged', $total_pages ) );
    exit;
}

// Used in the HTML title tag. $title       = __( 'Users' );
$parent_file = 'users.php';

$allowed_statuses = array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled' );

        $status = 'all';
        if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status']$allowed_statuses, true ) ) {
            $status = $_REQUEST['plugin_status'];
        }

        if ( isset( $_REQUEST['s'] ) ) {
            $_SERVER['REQUEST_URI'] = add_query_arg( 's', wp_unslash( $_REQUEST['s'] ) );
        }

        $page = $this->get_pagenum();

        $this->show_autoupdates = wp_is_auto_update_enabled_for_type( 'plugin' )
            && current_user_can( 'update_plugins' )
            && ( ! is_multisite() || $this->screen->in_admin( 'network' ) );
    }

    /** * @return array */
    protected function get_table_classes() {
        return array( 'widefat', $this->_args['plural'] );
    }
foreach ( $themes as $key => $theme ) {
                if ( ! $this->search_theme( $theme ) ) {
                    unset( $themes[ $key ] );
                }
            }
        }

        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,
            )
        );


/** Load WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'manage_sites' ) ) {
    wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
}

$wp_list_table = _get_list_table( 'WP_MS_Sites_List_Table' );
$pagenum       = $wp_list_table->get_pagenum();

// Used in the HTML title tag. $title       = __( 'Sites' );
$parent_file = 'sites.php';

add_screen_option( 'per_page' );

get_current_screen()->add_help_tab(
    array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        
Home | Imprint | This part of the site doesn't use cookies.