• Hello fellows,
    I want to paginate my custom taxonomy terms but it seens i had run in some king of problem. I saw an post and I had made exacly like its there (well I supose, maybe I dont see the problem).

    So I try to display the taxonomy terms in Homepage.

    Taxonomy Name: proiecte
    This is my code:

    <?php
    		if ( get_query_var( 'paged' ) )
    			$paged = get_query_var('paged');
    		else if ( get_query_var( 'page' ) )
    			$paged = get_query_var( 'page' );
    		else
    			$paged = 1;
    
    		$per_page    = 3;
    		$number_of_series = count( get_terms( 'proiecte' ) );
    		$offset      = $per_page * ( $paged - 1) ;
    
    		// Setup the arguments to pass in
    		$args = array(
    			'orderby'           => 'modified',
    			'order'             => 'ASC',
    			'hide_empty'        => false,
    			'childless'         => false,
    			'offset'       => $offset,
    			'number'       => $per_page
    		);
    		$categorii = get_terms( 'proiecte', $args );
    		// var_dump($categorii);
    		foreach ($categorii as $key) {
    			$id = $key->term_id;
    			$poza_coperta = get_field('poza_coperta', 'proiecte_'.$id );
    			$nume = $key->name;
    			$cartier = get_field('cartier', 'proiecte_'.$id );
    		?>
    		<div class="col-md-3">
    			<div class="each-proiect proiect">
    				<div class="poza-proiect">
    					<a href="<?php echo get_term_link( $key ); ?>"><img src="<?php echo $poza_coperta['sizes']['poza_proiect']; ?>" alt=""></a>
    				</div>
    				<div class="proiect-detalii text-center">
    					<a href="#"><?php echo $nume; ?></a>
    					<span><?php echo $cartier; ?></span>
    				</div>
    			</div>
    		</div>
    	<?php } ?>
    </div>
    <div class="row">
    	<div class="col-md-12">
    	<?php
    		global $wp_query;
    
    		$big = 999999999; // need an unlikely integer
    
    		if (function_exists("wp_pagenavi")) {
    		echo paginate_links( array(
    			'base'    => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    			'format'  => '?paged=%#%',
    			'current' => $paged,
    			'total'   => ceil( $number_of_series / $per_page ) // 3 items per page
    		) );
    	} ?>
    	</div>
    </div>

    The problem is that if I go to /page/2 it will bring me to the correct page, but the pagination numbers and stuffs isnt displayed. Website here: https://bit.ly/1QIVb5E
    Please fellows, give me a clue ….. I just can`t figure out.

  • The topic ‘Custom Pagination on custom taxonomy terms’ is closed to new replies.