Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

RDStudent on "Page Navigation Next Prev"

$
0
0

Hello,
I am wondering if someone can help me out. I have a custom-page-template that uses this query:

<?php // The Query
      query_posts( array ('category_name' => 'for-sale', 'posts_per_page' => 2) ); ?>

And these controlls

<?php global $wp_query;
       if($wp_query->max_num_pages > 1) :?>

<?php previous_posts_link('&larr; Previus Page', $wp_query->max_num_pages);?>
<?php next_posts_link('Next Page &rarr;', $wp_query->max_num_pages);?>

Issue I am getting is that, Next and Prev works fine. I always get correct number of pages and all but my content always stays the same.

I figured issue is every time the page reloads on Next and Prev, query runs and gets first X number of items.

I am wondering how I can do this and if this is even possible to do:
I am thinking to create a global control variable X like +1 -1, that will be incremented and decremented by Next and Prev buttons.

Now when the page loads I would say wp_guery(indexOf X).

Is this possible ?


Viewing all articles
Browse latest Browse all 8245

Trending Articles