WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi showing same posts on all paginated pages (3 posts)

  1. antistandard
    Member
    Posted 3 years ago #

    Hello everyone,

    I am yet another person stuck with not being able to get WP-PageNavi to work properly. I don't get any errors but when I click a page number in the pagination nav, the same posts re-load and the url has "/page/3/" or whatever after it.
    I know it is not a pagenavi problem and I more to do with wordpress not knowing what page it is looking at or something.

    does anyone have a solution please as I have tried all solutions so far without success. Here is my code with the latest solution applied. Thank you

    <h4 class="underlined">Recent Posts</h4>
    	<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$ids = array();
    	query_posts('posts_per_page=10','showposts='.$latest_num.'&cat=-1,-3,-6,-7,-14'.$breaking_cat.','.$latest_ignore.'&order=desc'.'&paged=$paged'); ?>
    
    	 <? if (have_posts()) : while (have_posts()) : the_post(); ?>
    	 <? $ids[]= $post->ID; ?>
    
    	 <? if( $post->ID == $do_not_duplicate ) continue; 	?>
    		<div id="date">
    			<span class="date-month"><?php the_time('M') ?></span>
    			<span class="date-day"><?php the_time('j') ?></span>
    			<span class="date-year"><?php the_time('Y') ?></span>
    		</div>
    		<div class="entry">
    			<h2><?php the_title(); ?></h2>
    			<div id="meta-post">
    				<?php include (TEMPLATEPATH . '/inc/meta-post.php' ); ?>
    			</div>
    			<div id="post-image">
    				<?php the_post_thumbnail( 'thumbnail' ); ?>
    			</div>
    			<?php the_excerpt(); ?>
    			<span class ="read_more"><a href="<?php the_permalink(); ?>">Read the Full Story</a> <span class="pipe">|</span> <span class="leave-comment"><?php comments_popup_link('Leave a Comment'); ?></span></span>
    		</div>
    		<? endwhile; 
    
    		wp_pagenavi();
    
    		endif; ?>
  2. stvwlf
    Member
    Posted 3 years ago #

    One thing I see that won't work is this

    '&paged=$paged');

    it needs to be this
    "&paged=$paged");

    Its a PHP thing.
    single quotes is a string
    double quotes inserts the value of the PHP variable into the expression

    the first one translates to
    &paged=$paged

    the second one translates to
    &paged=1

    You need the second one, which you get by using
    "&paged=$paged");

  3. antistandard
    Member
    Posted 3 years ago #

    ok great thanks, I'll try it out when i get a chance and let you know how i go

Topic Closed

This topic has been closed to new replies.

About this Topic