• I’m using the wp_pagenavi plugin and for some reason every time I click to go on another page it takes me back to my homepage.

    I have a custom homepage and I am displaying all posts on a page called “Blog”

    Any help would be appreciated.

    <?php get_header(); ?>
    
    	<div class="container group">
    
    <?php get_sidebar();?>
    
    		<?php if (have_posts()) : ?>
    		<?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query('posts_per_page=8&paged=' . $paged); while ($wp_query->have_posts()) : $wp_query->the_post();?>
    
    			<?php include('loop.php'); ?>
    
    		<?php wp_pagenavi(); ?>
    		<?php endwhile; $wp_query = null; $wp_query = $temp; ?>
    		<?php else : ?>
    		<?php endif; ?>
    
    	</div><!--/.container-->
    
    <?php get_footer(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter HappyCloud

    (@happycloud)

    Anyone have any ideas?

    I’m still clueless as to why this is happening

    maybe try adding this before $temp.

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

    ———-edit—– \/

    try doing something like this before if has posts:

    <?php
      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('orderby=date&showposts=16&paged=' . $paged);
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pagination problem’ is closed to new replies.