WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
wp_pagenavi on archive.php (4 posts)

  1. trixienolix
    Member
    Posted 3 years ago #

    hi pagenavi is working fine on category pages and tag.php but not on my archive.php.

    Maybe it's my code?

    <?php // query the posts
    		  query_posts( array( 'cat' => 12, 'order' => DESC, 'paged' => get_query_var('paged') ) );
    
    // have some posts?
    if (have_posts()) :
    	while (have_posts()) : the_post(); // begin the Loop; ?>
         <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <?php the_post_thumbnail(); ?>
       <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
        <span class="postdate"><?php the_time('F jS, Y') ?></span>
    	      <?php the_excerpt(); ?>
             <span class="tags"><?php the_tags(' ',' , '); ?></span>
             </div>
    <?php endwhile; ?>
    <?php if(function_exists('wp_pagenavi')) {
        wp_pagenavi();
    } ?>
    <?php endif; ?>

    any help gladly received.

    What i get with this is pagination through my category 12... rather than pagination through the archive of my category 12.

  2. trixienolix
    Member
    Posted 3 years ago #

    Ahh i shuol dprobably mention that I'm using this code in my functions.php so that I only get an archive of category 12, rather than an archive of all posts:

    /**
     * lets you display an archive of a certain category only e.g. blog
     */
    add_filter( 'getarchives_where', 'customarchives_where' );
    add_filter( 'getarchives_join', 'customarchives_join' );
    
    function customarchives_join( $x ) {
    
        global $wpdb;
    
        return $x . " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)";
    
    }
  3. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    What i get with this is pagination through my category 12... rather than pagination through the archive of my category 12.

    I don't understand the distinction.

  4. trixienolix
    Member
    Posted 3 years ago #

    well i've reached my archive page by being in my blog (cat 12) and clicking on a date, say "june 2011"... then I should see the list of posts from cat 12 that were written in June 2011, and if needed then the pagination should kick in i.e. i see page 1 of june 2011 blog posts, or page 2 of June 2011 blog posts.

    What i get though is page 1 of june 2011 blog posts and a whole load of page numbers, which when i click through them take me to the pages of ALL blog posts (rather than page x of june 2011 blog posts.

    hope that makes sense??!

    thank you

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic