WordPress.org

Ready to get started?Download WordPress

Forums

Pagination in archive.php not working (2 posts)

  1. Midhun007
    Member
    Posted 1 year ago #

    I have created a custom archive.php page by adding some extra code to the default archive.php. I want to do pagination in that page but , don't know why, it is not working. I use wp-pagenavi plugin for pagination. It shows the page not found error when I click on the '2' to navigate to the 2nd page.

    following is my custom archive.php code

    <?php get_header(); ?>
    
    <div class="archive_page">
    <?php
    $paged =(get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array_merge($wp_query->query, array('cat'   =>'-1,-8,-9',
    'posts_per_page'=>'2','paged' =>$paged));
    query_posts($args);
    ?>
    <?php if ( have_posts() ) : ?>
    <header class="page-header">
    <h1 class="page-title">
    <?php if ( is_day() ) : ?>
    <?php printf( __( 'Daily Archives: %s', 'twentyeleven' ), '<span>' . get_the_date() . '</span>' ); ?>
    <?php elseif ( is_month() ) : ?>
    <?php printf( __( 'Monthly Archives: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyeleven' ) ) . '</span>' ); ?>
    <?php elseif ( is_year() ) : ?>
    <?php printf( __( 'Yearly Archives: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentyeleven' ) ) . '</span>' ); ?>
    <?php else : ?>
    <?php _e( 'Blog Archives', 'twentyeleven' ); ?>
    <?php endif; ?>
    </h1>
    </header>
    <div id="navig">
        <?php if (function_exists('wp_pagenavi')){wp_pagenavi();}?>
    </div>
    <?php while ( have_posts() ) : the_post();?>
    	<div id="all_posts">
    	<div id="auth_ava">
    	<?php echo get_avatar( get_the_author_email(), '65');?>
    	</div>
    	<div class="post_title_archive">
    	<?php
    	the_title();
    	?>
    	</div>
    	<div id="name_date_coment_tag">
    	<div id="auth_dis_name">
    	<?php the_author_posts_link();?>
    	</div>
    	<div class="border">|</div>
    	<div id="posted_date_archive">
    	<?php
    	the_time('F j, Y');
    	?>
    	</div>
    	<div class="border">|</div>
    	<div class="categories">
    	Categories: <?php the_category(', '); ?>
    	</div>
    	<div class="border">|</div>
            <div id="tags_archive">
            <?php
    	the_tags('Tags: ', ', ', '<br />');
    	?>
    	</div>
    	</div>
    	</div>
    	<div class="excerpt_archive">
    	<?php
    	the_excerpt();
    	?>
            </div>
    	<?php endwhile; ?>
    	<div id="navig">
    	<?php
    	if (function_exists('wp_pagenavi')){wp_pagenavi();}
             ?>
    	</div>
    	<?php else : ?>
            <article id="post-0" class="post no-results not-found">
    	<header class="entry-header">
    	<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
    	</header>
           <div class="entry-content">
          <p>
          <?php _e( 'Apologies, but no results were found for the
          requested archive. Perhaps searching will help find
            a related post.', 'twentyeleven' ); ?>
         </p>
        <?php get_search_form(); ?>
        </div>
    </article>
    <?php endif; ?>
    </div>
    <?php get_footer(); ?>
  2. Justin
    Member
    Posted 1 year ago #

    I would post on the plugin author support forum. They will be able to help you over there.

    http://wordpress.org/support/plugin/wp-pagenavi

Topic Closed

This topic has been closed to new replies.

About this Topic