WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Problem creating Next/Previous pagination with my theme

[Resolved] Problem creating Next/Previous pagination with my theme

  • Ok, I’ve done quite a bit of research and this is what I’ve found

    This thread

    Talks about an issue with query_posts removing pagination capabilities

    Which is furthered by this thread

    Here is my loop from the template

    <?php	
    
    		$the_query = new WP_Query('cat=-'. $GLOBALS[ex_feat] . ',-' . $GLOBALS[ex_vid] . '&showposts=' . get_option('woo_other_entries') . '&orderby=post_date&order=desc');
    
    		$counter = 0;
    
    		while ($the_query->have_posts()) : $the_query->the_post(); $do_not_duplicate = $post->ID;
    	?>
    
    		<?php $counter++; ?>

    Where do I go from here?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Don’t know if this will help, but this is the URL

    Sinphoto.com Safe for work, just a catchy name

    Where do I go from here?

    apply the code that was suggested in those threds?

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    $the_query = new WP_Query('cat=-'. $GLOBALS[ex_feat] . ',-' . $GLOBALS[ex_vid] . '&showposts=' . get_option('woo_other_entries') . '&orderby=post_date&order=desc&paged=' . $paged);

    Not to sound rude, but I tried that and many different instances of before posting the dilemma.

    adding that $paged line without doing some tweak to the $the_query string leads to

    Parse error: syntax error, unexpected $end in ^/blog.php on line 50

    which ends up being a </div> tag and I have no idea why.

    ok
    this was able to create something using Page_navi

    $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query("paged=$page&cat=3");
    if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
    while ($wp_query->have_posts()) : $wp_query->the_post();

    <– stuff –>

    <?php endwhile ?>
    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
    <?php $wp_query = null; $wp_query = $temp; ?>

    But I have no idea how to integrate that with the existing loop parameters

    $the_query = new WP_Query('cat=-'. $GLOBALS[ex_feat] . ',-' . $GLOBALS[ex_vid] . '&showposts=' . get_option('woo_other_entries') . '&orderby=post_date&order=desc');
    		$counter = 0;
    while ($the_query->have_posts()) : $the_query->the_post(); $do_not_duplicate = $post->ID;

    So i don’t get a double loop! At least the pagination buttons appear haha man that felt great!

    Ok. I got one of the plugins to semi-work. WP-pagination now displays pages, but loads the same posts

    I added this code

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
               $offset = ($paged*10)-10;
               $offset = ($offset <= 0) ? 0 : $offset;
               $args = array('category_name'=>'nightlife','posts_per_page'=>10,'paged'=>$paged,'offset'=>$offset); query_posts($args);
               $posts_remaining = $the_query->found_posts-$offset;

    <– Stuff Happens –>

    <?php if(function_exists('wp_paginate')) {
        wp_paginate();
    } ?>

    I know part of my problem is with the category_name being called and I am trying to make that dynamic so it will paginate on each category page.

    The main page shows the pagination tab (first time I’ve seen it in the last 36 hours) but loads the same 5 posts

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Problem creating Next/Previous pagination with my theme’ is closed to new replies.
Skip to toolbar