WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
Navigation buttons always return me to the first page (5 posts)

  1. AndrewHodges
    Member
    Posted 1 year ago #

    I have a page where the navigation buttons 1, 2 and next always return me to page one.

    The only things I can see that might make a difference is that the query is for one category only. But everything else is very standard.

    When button 2 is pressed the link is http://fernleafconsulting.co.uk/FLWP/wordpress/page/2/ but displays page one?

    Have you seen this issue before. the query looks like this.

    query_posts('cat=66');// Only uses the one catagory from posts
    			if (have_posts()) : while (have_posts()) : the_post(); 
    
    					// The following determines what the post format is and shows the correct file accordingly
    					$format = get_post_format();
    					get_template_part( 'includes/post-formats/'.$format );
    
    					if($format == '')
    					get_template_part( 'includes/post-formats/standard' );
    
    			 endwhile;

    The navi function follows

    http://wordpress.org/extend/plugins/wp-pagenavi/

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    nothing to do with wp-pagenavi;

    the query should also contain the 'paged' parameter;
    http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters

    for example, try:

    query_posts('cat=66&paged='.get_query_var('paged'));

    or alternatively try to merge your cat=66 into the existing query:

    global $wp_query; $args = array_merge( $wp_query->query_vars, array( 'cat' => 66 ) ); query_posts( $args );

    http://codex.wordpress.org/Function_Reference/query_posts#Preserving_Existing_Query_Parameters

  3. AndrewHodges
    Member
    Posted 1 year ago #

    A little belated but that you for replying. I did in fact re-write the query

  4. kishor151
    Member
    Posted 1 year ago #

    Hello @alchymyth
    I am also having the same problem on my home page...
    I see your response for solution but dont know exactly how to implement.
    Can you please clarify a little more...

    here is my code for Index.php, and I am using Zenshop theme with cart66 lite on wp-pagenavi version 2.83

    Here is the code for index.php:

    <?php get_header(); ?>
    
    <?php
    
    if(get_option('zens_home') == "blog") { ?>	
    
    <?php include (TEMPLATEPATH . '/lib/blog-home.php'); ?>
    
    <?php } else { ?>
    
    <div id="featured">
    
    <div class="flexslider">
    
    	<ul class="slides">
    
    	<?php 
    
    		$slide = get_option('zens_slide_cat');
    
    		$count = get_option('zens_slide_count');
    
    		$slide_query = new WP_Query( 'post_type=products&product-category='.$slide.'&posts_per_page='.$count.'' );
    
    		while ( $slide_query->have_posts() ) : $slide_query->the_post();
    
    	?>	
    
    <li>
    		<a>"><img class="slideimg" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo get_image_url()?>&h=300&w=500&zc=2" title="" alt="" /></a>
    
    		<div class="flex-caption">
    
    			<h2><a>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
    			<?php wpe_excerpt('wpe_excerptlength_slide', ''); ?>
    
    			<div class="slidetab">
    
    			<span class="sprice"><?php $price=get_post_meta($post->ID, 'w2f_price', true); echo $price; ?></span>
    
    			<span class="spdetails"><a>">Product Details</a></span>
    
    			</div>
    
    		</div>
    
    </li>
    	<?php endwhile; ?>
    
    </div>
    
    </div>
    
    <div id="home-content" class="clearfix">
    
    <ul id="shelf">
    
    	<?php
    
    		$home_count = get_option('zens_home_count');
    
    		$temp = $wp_query;
    
    		$wp_query= null;
    
    		$wp_query = new WP_Query();
    
    		$wp_query->query('posts_per_page='.$home_count.'&post_type=products'.'&paged='.$paged);
    
    	?>
    
    	<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>	
    
    	<li class="box" id="post-<?php the_ID(); ?>">
    
    	<?php $disc = get_post_meta($post->ID, 'w2f_discount', true); ?>
    
    	<?php if ( $disc ) { ?>
    
    			<span class="salebadge"></span>
    
    	<?php }?>
    
    		<div class="boxtitle">
    
    			<h2><a>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
    		</div>
    
    		<a>"><img class="productshot" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=200&w=170&zc=2" alt=""/></a>
    
    		<div class="pricetab clearfix">
    
    		<?php if ( $disc ) { ?>
    
    			<span class="oldprice"><del> <?php echo get_post_meta($post->ID, 'w2f_disc-price', true) ?> </del></span>
    
    		<?php }?>
    
    		<span class="price"><?php $price=get_post_meta($post->ID, 'w2f_price', true); echo $price; ?></span>
    
    		<span class="prodetail"><a>">Details</a></span>
    
    		</div>
    
    	<?php endwhile; ?>
    
    	<div class="clear"></div>
    
    	<?php getpagenavi(); ?>
    
    	<?php $wp_query = null; $wp_query = $temp;?>
    
    </div>
    
    <?php get_footer(); ?>
    
    <?php } ?>

    [Please post code or markup between backticks or use the code button. Or better still - use a pastebin. Your posted code has now been permanently damaged/corrupted by the forum's parser.]

    thanks in advance for any help.
    And here is the link:
    http://bhimphedi.com/pearl

  5. esmi
    Forum Moderator
    Posted 1 year ago #

    I'm sorry but as you are using a non-WPORG theme, you need to seek support from the theme's developers - paid or otherwise. We only support themes downloaded from wordpress.org here.

    And next time, please post your own topic.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags