Pagination when doing an AJAX query
-
I set up a site specific plugin where I have the code to do an AJAX query. My problem is that when I try to add pagination to it the resulting pagination links look this:
//https://mysite.org/wp-admin/admin-ajax.php?action=get_my_ajax_posts&tags=drama#038;tags=drama&paged=2
that fails of course, normally pagination links look like this
https://mysite.org/film-list/page/2/
Is there some kind of trick to getting pagination in this situation? Or should I query for all posts and then figure out how to display 50 per page and do some kind of faux pagination with Javascript?
Here is the code I use to get the pagination:
$big = 999999999; $paginator = paginate_links( array( 'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $search_query->max_num_pages, 'prev_text' => '«', 'next_text' => '»' ) ); $result[0]["pagination"] = $paginator;
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Pagination when doing an AJAX query’ is closed to new replies.