'profile', 'plural' => 'profiles', 'ajax' => false ) ); } function column_default($item, $column_name){ switch($column_name) { case 'actions' : $act = '
Edit'; $act .= '   Delete
'; return $act; break; default : return '
'.$item->$column_name.'
'; break; } } function column_cb($item){ return sprintf( '', $this->_args['singular'], $item->id ); } function get_columns(){ $columns = array( 'cb' => '', 'name' => 'Profile Name', 'id' => 'Profile ID', 'width' => 'Player Width', 'height' => 'Player Height', 'actions' => 'Actions' ); return $columns; } function get_bulk_actions() { $actions = array( 'delete' => 'Delete' ); return $actions; } function process_bulk_action() { if( 'delete'===$this->current_action() ) { foreach($_GET['profile'] as $profile) { $this->wpdb->query("DELETE FROM $this->table_name WHERE id=".$profile); } echo ''; } } function prepare_items( $data, $table_name, $wpdb ) { $this->table_name = $table_name; $this->wpdb = $wpdb; $columns = $this->get_columns(); $hidden = array(); $sortable = array(); $this->_column_headers = array($columns, $hidden, $sortable); $this->process_bulk_action(); $per_page = 5; $current_page = $this->get_pagenum(); $total_items = count($data); $data = array_slice($data,(($current_page-1)*$per_page),$per_page); $this->items = $data; $this->set_pagination_args( array( 'total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items/$per_page) ) ); } } $table = new AllVideoGallery_Table(); $data = $wpdb->get_results("SELECT * FROM $table_name"); $table->prepare_items( $data, $table_name, $wpdb ); ?>
display(); ?>