1

Wordpress WP-PageNavi plugin gettinf 404 error. here is my code.

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

   query_posts(array(
    'posts_per_page' => 3,
    'paged' => $paged
   )
  ); ?>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<?php the_title('<h1 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></h1>'); ?>

 <?php endwhile;  if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>

   <?php wp_reset_query(); else : ?>

<p class="no-posts"><?php _e('Sorry, no posts matched your criteria', 'example');  </p>

  <? php endif; ?>  
0

Maybe you missed the object here, and by the way why do you use query_posts() ? You can try this :

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

 $args = array(
   'posts_per_page' => 3,
   'paged' => $paged
); 

$query = new WP_Query($args);
if($query->have_posts()) : while($query->have_posts()) : $query->the_post(); ?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<?php the_title('<h1 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></h1>'); ?>

<?php endwhile;  if(function_exists('wp_pagenavi')) { wp_pagenavi($query); } ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.