• On each page of the website with this plugin the pagination shows it as the max number of pages, except for the first page which shows 1 out of 0.

    Page one = 1 out of 0
    Page two = 2 out of 2
    Page three = 3 out of 3

    The pages themselves link correctly. I feel like I’m missing something basic that would cause this problem.

    https://www.ads-software.com/plugins/wp-pagenavi/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Lester Chan

    (@gamerz)

    Does it work on the default theme? Your theme/plugin might be messing around with the max posts.

    Thread Starter lordnine

    (@lordnine)

    Just tried switching to the default, still has the same problem.

    Plugin Author Lester Chan

    (@gamerz)

    How about deactivating the rest of the plugins? Because one of theme might be messing with the pagination. Also a URl with the problem will help.

    Thread Starter lordnine

    (@lordnine)

    Hi sorry, I didn’t get a notice that someone had replied.

    I actually inherited this website project so I’m not sure how it really works. Far as I can tell, the original designer created standalone templates instead of applying the pagination directly into the theme. That or he did it correctly and I’m just not understanding how it works.

    For the time being I hard coded the results we wanted at the bottom, but could you take a look at the code and see what might be wrong?

    <?php
    
    /* Template Name: Talk Story*/
    
    ?>
    
    <?php
    
    get_header();
    
    ?>
    
    <div id="container">
    
            <div class="page_title">
    	<?php if ( has_post_thumbnail()) : ?>
    
    	<?php the_post_thumbnail('page_image'); ?>
    
            <?php endif; ?>
    
    	<?php the_title(); ?>
    
         	</div>
    
         <div id="masseges-educate">
    
           <?php
    
    	$short_message = get_post_meta($post->ID, 'short_message', true);
    
    	if($short_message){
    
    	?>
    
    	<?php echo $short_message; ?>
    
    	<?php } ?>
    
         </div>
    
    	<?php
    	global $paged;
     	$curpage = $paged ? $paged : 1;
    	$loop = new WP_Query( array(
    	'category_name'=>'talk_story',
    	'post_type' => 'post',
    	'paged' => $paged,
    	'posts_per_page' => 15,
    	'orderby' => 'date',
    	'order' => 'ASC' ) );
    	?>	
    
    	<div id="talk_story">
    
              <ul>
    
                <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    
                <li>
    
                <div class="story_photo">
    		<?php the_post_thumbnail('feature-thumbnail'); ?>
    	    </div>
    
    	    <div class="arrow2"></div>
    
    		<div class="sub_container">
                    <h1><?php the_title(); ?></h1>
    
    		<div class="post-subtitle">
    		<?php
    		$short_message = get_post_meta($post->ID, 'heading_message', true);
    		if($short_message){
    		?>
    
    		<?php echo $short_message; ?>
    
    		<?php } ?>
    		</div>
    
                   <?php the_excerpt(); ?>
    
                </div>
    
                </li>
    
                <?php endwhile; ?>
    
             </ul>
    
    </div>
    
    <?php     echo '
    
        <div id="blog_listining_pagianation">
            <a class="first page button" href="'.get_pagenum_link(1).'">&laquo;</a>
    
            <a class="previous page button" href="'.get_pagenum_link(($curpage-1 > 0 ? $curpage-1 : 1)).'">prev.page</a><div class=no_of_pages> <span>'.$curpage.'</span> of <span> '.$paged.'  </span> Pages </div>';
    
            for($i=1;$i<=$loop->max_num_pages;$i++)
    
                echo '<a class="'.($i == $curpage ? 'active ' : '').'page button" href="'.get_pagenum_link($i).'">'.$i.'</a>';
            echo '
            <a class="next page button" href="'.get_pagenum_link(($curpage+1 <= $loop->max_num_pages ? $curpage+1 : $loop->max_num_pages)).'">next page</a>
            <a class="last page button" href="'.get_pagenum_link($loop->max_num_pages).'">&raquo;</a>
        </div>
        ';
    
    wp_reset_postdata();
    
    ?>
    
    <?php get_footer(); ?>

    In the live site, I have hard coded the ‘.$paged.’ into the correct number, but that is obviously not ideal.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Links work but page numbers are wrong’ is closed to new replies.