• rftbdev

    (@rftbdev)


    When pagination is set to true, and we are limiting the number of posts retrieved by 6, how do we figure out the total number of pages based on the total number of posts and the limit we are setting?

    The following code shows how to do the above question in a typical WordPress query:

    
    $args = array(
    'ajaxurl' => site_url() . '/wp-admin/admin-ajax.php',
    'posts' => json_encode($events->query_vars),
    'current_page' => $events->query_vars['paged'] ? $events->query_vars['paged'] : 1,
    'max_page' => $events->max_num_pages
    )
    

    the following code is my args array passed to the get method on the EM_Events class

    
    $posts = EM_Events::get(array(
    		'scope' => 'future',
    		'limit' => 6,
    		'pagination' => 1,
    		'category' => $_POST['event-category'],
    	));
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter rftbdev

    (@rftbdev)

    Thread Starter rftbdev

    (@rftbdev)

    ive tried $_REQUEST[‘pno’] to get the current page as well with no luck

    bojates

    (@bojates)

    It’s not totally clear what you’re trying to achieve overall, and haven’t ever worked with the pagination, other than using it out of the box. However, I suggest you look more closely at the docs. I have had success using the shortcodes with paramaters, and you can embed template code in the shortcodes. You can also write your own templates to be called in, or implement quite complex logic within the display options provided in the form. You may get more mileage that way in the longer term. The Advanced Usage and Developer Docs sections are good:

    https://wp-events-plugin.com/documentation/

    Good luck.

    Thread Starter rftbdev

    (@rftbdev)

    thank you @bojates I appreciate you taking your personal time to respond. Thanks for the info about shortcodes

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Max Pages in Pagination’ is closed to new replies.