WP_List_Table::prepare_items()

Prepares the list of items for displaying.


Source Source

File: wp-admin/includes/class-wp-list-table.php

	public function prepare_items() {
		die( 'function WP_List_Table::prepare_items() must be overridden in a subclass.' );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Niloy
       /**
         * Prepares the list of items for displaying.
         */
        public function prepare_items() {
        
            $columns = $this->get_columns(); 
            $hidden = array();
            $sortable = $this->get_sortable_columns();
    
            $per_page = 10;
            $current_page = $this->get_pagenum();
            $offset = ( $current_page - 1 ) * $per_page;
    
            $this->_column_headers = array($columns, $hidden, $sortable);
    
            $args = array(
                    'numberposts' => $per_page,
                    'offset'      => $offset,
            );
            
            if( isset( $_REQUEST['orderby'] ) && isset( $_REQUEST['order'] ) ) {
                $args['orderby'] = $_REQUEST['orderby'];
                $args['order'] = $_REQUEST['order'];
            }
    
            $this->items = woo_deposits_get_orders($args);
    
            $this->set_pagination_args(
                array(
                'total_items' => woo_deposits_count(),
                'per_page'    => $per_page,
                )
            );
            
        }

You must log in before being able to contribute a note or feedback.