Skip to content

Wordpress Pagination #173

Closed
aminriadh opened this Issue Mar 2, 2013 · 1 comment

2 participants

@aminriadh

Wordpress already has built in pagination function.

I have to keep replacing this '<?php s_content_nav( 'nav-below' ); '

for Index, Archive, Search results pages.

The only place I leave it is in the singles.


I use something like this:

/**
 * Implement the Custom pagination
 */
function k9_pagination() {
global $wp_query;
    $big = 999999999; // need an unlikely integer
    $count = $wp_query->max_num_pages; 

    if ($count>"1") {
        echo  '<div class="page-nav">';
        echo    paginate_links( array(
            'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
            'format' => '?paged=%#%',
            'current' => max( 1, get_query_var('paged') ),
            'total' => $wp_query->max_num_pages
        ) ); 
        echo  '</div>'; }
        else {} 
    }
add_action( 'wp_enqueue_scripts', 'k9_scripts' );
@obenland

_s is supposed to be a smart starter theme, I'm not sure adding a pagination out of the box, especially with a custom function, would be the best way to go.

@obenland obenland closed this Mar 14, 2013
@obenland obenland removed the Close label Mar 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.