0

How to get query for posts from next and previous pages on Blog via ajax call?

I'm thinking about making copy of the current query with offset like this:

$curr_query = new WP_Query( array(
    'order'          => get_query_var( 'order' ),
    'orderby'        => get_query_var( 'orderby' ),
    'post_status'    => get_query_var( 'post_status' ),
    'posts_per_page' => get_query_var( 'posts_per_page' ),
    'post_type'      => get_query_var( 'post_type' ),
    'offset'         => $offset,
) );

But it has too many 'get_query_var' parameters, I don't know all query_vars I need to copy to create query for the 'next page'.

  • Did you tried anything yet? If yes can you share it over here. – Mohammad Mursaleen Aug 8 '15 at 3:57
  • I have only idea about cloning current query with get_query_var function. – Layka Aug 8 '15 at 5:38
  • Are you trying to develop ajax based pagination? – Mohammad Mursaleen Aug 8 '15 at 5:59
  • Yes, ajax 'load more posts' button. – Layka Aug 8 '15 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.