Beispiel #1
0
<?php 
if (is_user_logged_in()) {
    //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']);
Beispiel #2
0
if ($loop->have_posts()) {
    /**
     * wps_deals_before_archive_loop hook
     *
     * @hooked wps_deals_count - 20
     * @hooked wps_deals_ordering - 30
     */
    do_action('wps_deals_before_home_loop');
    ?>

	<div class="deals-home-list">
	
	<?php 
    /** Start of paging **/
    // create pagination object
    $paging = new Wps_Deals_Pagination_Public('wps_home_deals_ajax_pagination');
    // Get per page from settings
    $deals_per_page = $wps_deals_options['deals_per_page'];
    $perpage = isset($deals_per_page) ? $deals_per_page : -1;
    $paging->items($loop->found_posts);
    // set total founded deals
    $paging->limit($perpage);
    // limit entries per page
    // check paging is passed into post. if yes then set it to current page
    if (isset($_POST['paging'])) {
        $paging->currentPage($_POST['paging']);
        // gets and validates the current page
    }
    $paging->calculate();
    // calculates what to show
    $paging->parameterName('paging');