• Reading the function reference it seems as though I should be able to replace

    <?php next_posts_link('??') ?>
    
    <?php previous_posts_link('??') ?>

    with
    <?php wp_link_pages(); ?>

    To get paginated archives.
    I have my archives displayed in a grid layout, max of 16 with the code below, and want the site to paginate if archives are > 16, but show page numbers at the bottom, similar to << 1 2 3 4 >>

    <?php get_header(); ?>
    <div id="posts">
    
    	<?php $x = 0; ?>
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    			<?php if ( is_int( $x / 4 ) ) { ?>
    				<div class="clear">
    			<?php } ?>
    					<div class="archive-posts">
    						<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_post_thumbnail(); ?><br /><?php the_title(); ?></a>
    					</div>
    				<?php if ( is_int( $x / 4 ) ) { ?>
    					</div>
    				<?php }
    				 $x = $x + 1; ?>
    
    		<?php endwhile; ?>
    		<!--navigation-->
    		<div id="navlinks">
    <?php next_posts_link('??') ?>  <?php previous_posts_link('??') ?>  </div>
    		<span class="clear"></span>
    
    	<?php else : ?>
    <div class="text-feedback">
    		Not Found<br /><br />
    <?php get_search_form('title='); ?></div>
    		<?php  // include (TEMPLATEPATH . '/searchform.php'); ?>
    
    	<?php endif; ?>
    
    	</div>
    <!--archive.php end-->
    
    <?php get_footer(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • wp_link_pages() is used to break a single long post into multiple pages, not to provide navigation to groups of posts.

    I think what you want is wp_paginate_links().

    Thread Starter gSaenz

    (@gsaenz)

    oh, of course.
    It is almost working like I want. The only issue is that the numbers are backwards but i cannot see in the reference that this can be controlled. It is showing

    previous 4321 next

    Here is my code

    <?php
    		$big = 999999999; // need an unlikely integer
    		echo paginate_links( array(
    			'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    			'format' => '?paged=%#%',
    			'total' => $wp_query->max_num_pages,
    			'current' => max( 1, get_query_var('paged') ),
    			'prev_text' => __('? anterior'),
     		    'next_text' => __('siguiente ?')
    			) );
    		?>

    Ideas?

    I have no idea what would cause that.

    Thread Starter gSaenz

    (@gsaenz)

    seems like if I change 'current' => max( 1, get_query_var('paged') ) to 'current' => 0 it works, but it then gets rid of my prev/next text at both ends

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Paginating archives next_posts_link to wp_link_pages’ is closed to new replies.