Here's my problem:
I have a Custom Post Type called Projects. In it's archive (archive-projects.php) I display a list of Clients (it's a custom taxonomy for this Projects).
This works great, you can see the clients and then click on it to see the projects related to that client.
The only issue is the pagination. In this archive-projects.php the pagination takes in consideration the number of projects but I'm actually only displaying the clients (taxonomy).
e.g: I have 10 clients (should be 1 page) but since I have 20 projects it shows 2 pages.
Is there any way to tell the pagination to use the data from the taxonomy get_terms query?
Here's my code:
<?php $args = array( 'posts_per_page' => 9, 'paged' => get_query_var('paged'), 'orderby' => 'name', 'order' => 'ASC', 'post_type' => 'projects', 'post_status' => 'publish' ); $clientes = get_terms( 'cliente', $args ); foreach ( $clientes as $cliente ) : $args = array( 'posts_per_page' => 1, 'orderby' => 'ID', 'order' => 'DESC', 'post_type' => 'projects', 'tax_query' => array( array( 'taxonomy' => 'cliente', 'field' => 'slug', 'terms' => $cliente->slug ) ), 'post_status' => 'publish' ); $projects = get_posts( $args ); foreach ( $projects as $post ) : setup_postdata( $post ); // Here we print the last proyect from this client endforeach; // END $projects foreach wp_reset_postdata(); endforeach; // END $clientes foreach posts_nav_link();