InstructorsList::prepare_items()
Source
File: classes/InstructorsList.php
function prepare_items() { $per_page = 20; $search_term = ''; if ( isset( $_REQUEST['s'] ) ) { $search_term = sanitize_text_field( $_REQUEST['s'] ); } $columns = $this->get_columns(); $hidden = array(); $sortable = $this->get_sortable_columns(); $this->_column_headers = array( $columns, $hidden, $sortable ); $current_page = $this->get_pagenum(); $args = [ 'search_term' => $search_term, 'start' => ( $current_page - 1 ) * $per_page, 'per_page' => $per_page, ]; $instructors = dozent_get_instructors( $args ); $this->items = $instructors->results; $this->set_pagination_args( array( 'total_items' => $instructors->count, 'per_page' => $per_page, 'total_pages' => ceil( $instructors->count / $per_page ) ) ); }