• Resolved jfgarsula

    (@jfgarsula)


    Hi guys,

    I am having a hard time on my custom post query paging. The tutorial that I followed is this one, https://weblogtoolscollection.com/archives/2008/04/19/paging-and-custom-wordpress-loops/.

    Using the code below

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$temp = $wp_query;
    	$wp_query= null;
    	$wp_query = new WP_Query();
    	$wp_query->query('category_name='.$deal_category.'&cat='.$all_deal_category_ids.'&showposts=6'.'&paged='.$paged);
    
    	while ($wp_query->have_posts()) : $wp_query->the_post();
    		CONTENT HERE
    	endwhile;
    	?>
        <div class="navigation">
    		<div class="alignleft"><?php previous_posts_link('&laquo; Previous') ?></div>
    		<div class="alignright"><?php next_posts_link('More &raquo;') ?></div>
        </div>
        <?php $wp_query = null; $wp_query = $temp;?>

    The output for the navigation is just this:

    <div class="navigation">
       <div class="alignleft"></div>
       <div class="alignright"></div>
    </div>

    What could be wrong with the codes?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try this:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$temp = $wp_query;
    	$wp_query= null;
    	query_posts('category_name='.$deal_category.'&cat='.$all_deal_category_ids.'&showposts=6'.'&paged='.$paged);
    
    	while (have_posts()) : the_post();
    		CONTENT HERE
    	endwhile;
    	?>
        <div class="navigation">
    		<div class="alignleft"><?php previous_posts_link('&laquo; Previous') ?></div>
    		<div class="alignright"><?php next_posts_link('More &raquo;') ?></div>
        </div>
        <?php $wp_query = null; $wp_query = $temp;?>
    Thread Starter jfgarsula

    (@jfgarsula)

    It worked! Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom post query paging’ is closed to new replies.