• At the end of my single page, I have a list with all the posts by title. I don’t won’t all of them to show up on the first page, so I need a pagination.

    The problem is that the pagination ain’t working. I have used the same one for every other page, but on this one it ain’t working. Any suggestions on why?

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
    <?php query_posts('category_name=video&posts_per_page=8&paged=' . $paged); ?>
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    CONTENT
    <?php
    global $wp_rewrite;
    $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
    
    $pagination = array(
    	'base' => @add_query_arg('page','%#%'),
    	'format' => '',
    	'total' => $wp_query->max_num_pages,
    	'current' => $current,
    	'show_all' => true,
    	'type' => 'plain'
    	);
    
    if( $wp_rewrite->using_permalinks() )
    	$pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );
    
    if( !empty($wp_query->query_vars['s']) )
    	$pagination['add_args'] = array( 's' => get_query_var( 's' ) );
    
    echo paginate_links( $pagination );
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pagination not working on single pages’ is closed to new replies.