• Just as the title says I am trying to display what page a user is on and what the total number of pages is.

    I tried this snippet but it keeps saying “1 of 1” even though I know there are two pages.

    <?php echo 'Page '.$page.' of '.$numpages.''; ?>

    Any ideas why? For reference, here’s my page code:

    <?php // Blog page template
    
    get_header(); ?>
    
    <main id="primary" class="entry-archive" role="main">
    
    	<div class="container">
    
    		<h1 class="page-title">My blog</h1>
    
    		<? // category picker ?>
    
    		<div class="clear"></div>
    
    	</div> <!-- end .container -->
    
    	<?php while (have_posts()) : the_post(); ?>
    
    		<?php get_template_part('content'); ?>
    
    	<?php endwhile; ?>
    
    	<?php echo 'Page '.$page.' of '.$numpages.''; ?>
    
    </main> <!-- end #primary .entry-archive -->
    
    <?php get_footer(); ?>

    Also, this is on the home.php page.

    Thanks!

  • The topic ‘Show current page and total number of pages’ is closed to new replies.