Disabling Pagination in Arras Archives

  1. Removing the pagination links (next/prev) from archive.php:27 was trivial:
    <div id="archive-posts">
        <?php arras_render_posts( null, arras_get_option('archive_display') ) ?>     
    
        <?php if(function_exists('wp_pagenavi')) wp_pagenavi(); 
        else { ?>
            <div>
                <div><?php next_posts_link( __('Older Entries', 'arras') ) 
                ?></div>
                <div><?php previous_posts_link( __('Newer Entries', 'arras') ) 
                ?></div>
            </div>
        <?php } ?>
        </div><!-- #archive-posts -->

  2. arras_render_posts() (library/template.php:157) uses the WP’s loop query, which has posts_per_page set to 10 globally, and it seems by the time Arras’s archive.php is invoked it’s too late — the query was already processed and cannot be modified?
    function arras_render_posts( $args = null, /*...*/ ) {
        /*...*/
        if ( ! $args ) {  
            $query = $wp_query;
        } else {
            $query = new WP_Query( $args );
        }
  3. A workaround would be to pass a new query instead of null. But how to keep the WP query’s other parameters, and modify just posts_per_page (or posts_per_archive_page)? And, for efficiency, how to avoid running another query by modifying WP’s?
  4. Or, an ugly hack around this, was to run another query, thus replacing the global $wp_query:
    query_posts($query_string . '&posts_per_archive_page=-1');  
    arras_render_posts( null, /*...*/);
  5. But really, this is definitely not the place to hardcode this option.


Comments are closed.