Support » Themes and Templates » WP Query and Pagination

WP Query and Pagination

  • mahodder


    I’m trying to implement pagination on my query but it doesn’t seem to be working at: http://www.bnoptwitter.nl/

    The query I built takes the most recent post from the categories listed and prints them out – I set WP to display max 1 post for testing and used the code below but it’s still showing 3.

    The following code is entered into a page, I then set this page as the homepage using the WordPress options.

    Anyone have any ideas on how to implement pagination correctly?

    for ($i = 1; $i <= 3; $i++) {
    if ($i==1) {$oi_cat = "3js";}
    if ($i==2) {$oi_cat = "marco-borsato";}
    if ($i==3) {$oi_cat = "adam-curry";}
    //The Query
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $query= 'category_name='.$oi_cat.'&showposts=1'.'&paged='.$paged;
    $recent = new WP_Query($query); while($recent->have_posts()) : $recent->the_post(); 
    global $more;    // Declare global $more (before the loop).
    $more = 0;       // Set (inside the loop) to display content above the more tag.
    <br clear="all">
    <div class="navigation">
      <div class="alignleft"><?php previous_posts_link('&laquo; Previous') ?></div>
      <div class="alignright"><?php next_posts_link('More &raquo;') ?></div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘WP Query and Pagination’ is closed to new replies.
Skip to toolbar