Support » Themes and Templates » Same posts showing on Blog Paganation pages

  • Hi Guys and gals,

    A blog that i’m working on is showing the same blogs on pages 2 and 3 of the paginated pages can some one have a look and my pagination code in my functions.php and tell me what i’m missing.

    Thanks Gary

    // function for pagination on index page
    function yourtheme_paging_nav() {
    	// Don't print empty markup if there's only one page.
    
    	if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
    
    				return;
    	}
    
        $paged        = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
        //$paged        = get_query_var( 'post' ) ? intval( get_query_var( 'post' ) ) : 1;
    	$pagenum_link = html_entity_decode( get_pagenum_link() );
    	$query_args   = array();
    	$url_parts    = explode( '?', $pagenum_link );
    
    	if ( isset( $url_parts[1] ) ) {
    		wp_parse_str( $url_parts[1], $query_args );
    	}
    
    	$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
    	$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
    
    	$format  = $GLOBALS['wp_rewrite']->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
    	$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%';
    
        $allpages=$GLOBALS['wp_query']->max_num_pages;
    	// Set up paginated links.
    	$links = paginate_links( array(
    		'base'     => $pagenum_link,
    		'format'   => $format,
    		'total'    => $GLOBALS['wp_query']->max_num_pages,
    		'current'  => $paged,
    		'mid_size' => 3,
    		'add_args' => array_map( 'urlencode', $query_args ),
    		//'prev_text' => __( '&larr; Previous', 'yourtheme' ),
    		//'next_text' => __( 'Next &rarr;', 'yourtheme' ),
    		'type'      => 'list',
    	) );
    
        //echo "<pre>";print_r($links);die;
    
    	if ( $links ) :
    
    	?>
    
       <li class="nextpage">
        <article class="jure">
    	<nav class="navigation paging-navigation" role="navigation">
    		<h1 class="screen-reader-text"><?php //_e( 'Posts navigation', 'yourtheme' ); ?></h1>
    			<?php echo $links; ?>
    			<span>Page <?php echo $paged ." of ". $allpages; ?> </span>
    	</nav><!-- .navigation -->
    
    	</article>
    	</li>
    
    	<?php
    	endif;
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Same posts showing on Blog Paganation pages’ is closed to new replies.