• Resolved yanks789

    (@yanks789)


    I know Pagination is used more for next/previous or older/newer but is it possible when at the newest post the options are to go to newest AND oldest, thus starting all over. Sam thing for the oldest post, the user clicking next would go to the next oldest post or the user would click previous taking them to the newest post.

    I’m looking to create an infinite circle effect because date does not really matter for my project, more the next/previous aspect.

    Any help is greatly appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    What functions does your theme use to show the pagination?
    http://codex.wordpress.org/Pagination#Function_Reference

    Thread Starter yanks789

    (@yanks789)

    My site is using

    <div id="page-navigation">
    
    <center><?php if(function_exists('wp_pagenavi')) : wp_pagenavi(); ?>
    
    <?php else : posts_nav_link(' ', __('Next', 'Vesta'), __('Previous', 'Vesta')); echo '<div class="clear"></div>'; endif;?></center>
    
    </div>
    Moderator keesiemeijer

    (@keesiemeijer)

    Try it with this:

    <div id="page-navigation">
    <center>
    <?php
    if ( function_exists( 'wp_pagenavi' ) ) {
    
    	wp_pagenavi();
    
    } else {
    
    	global $wp_query;
    
    	$next_label = __( 'Previous', 'Vesta' );
    	$prev_label =  __( 'Next', 'Vesta' );
    	$seperator = ' ';
    
    	$next = get_next_posts_link( $next_label );
    	$previous = get_previous_posts_link( $prev_label );
    	$html = '';
    
    	if ( $next ) {
    		$html .= $next;
    	} else {
    		$html .= '<a href="' . get_pagenum_link( 1 ) . '" >' . $next_label .'</a>';
    	}
    
    	$html .= $seperator;
    
    	if ( $previous ) {
    		$html .=  $previous;
    	} else {
    		$html .=  '<a href="' . get_pagenum_link( $wp_query->max_num_pages ) . '" >'. $prev_label .'</a>';
    	}
    
    	echo $html . '<div class="clear"></div>';
    }
    ?>
    </center>
    </div>

    Thread Starter yanks789

    (@yanks789)

    Perfect!!! Exactly what I was looking for. Thank you so much for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Pagination Continuous’ is closed to new replies.