//check user is logged in or not $perpage = isset($wps_deals_options['per_page']) ? $wps_deals_options['per_page'] : '10'; //model class $model = $wps_deals_model; //currency class $currency = $wps_deals_currency; //render class $render = $wps_deals_render; // creating new array for all sold deals count $argscount = array('author' => $current_user->ID, 'getcount' => '1'); //getting all sold deals count $datacount = $model->wps_deals_get_sales($argscount); // start paging $paging = new Wps_Deals_Pagination_Public(); $paging->items($datacount); $paging->limit($perpage); // limit entries per page if (isset($_POST['paging'])) { $paging->currentPage($_POST['paging']); // gets and validates the current page } $paging->calculate(); // calculates what to show $paging->parameterName('paging'); // setting the limit to start $limit_start = ($paging->page - 1) * $paging->limit; if (isset($_POST['paging'])) { //ajax call pagination $argsdata = array('author' => $current_user->ID, 'posts_per_page' => $perpage, 'paged' => $_POST['paging']); } else { //on page load