Set number of posts for custom taxonomy
We use a custom post type called “clients” to display our portfolio, which works perfect. This post type has a (category-like) taxonomy “services” to divide these client posts in two categories. The “query_posts” is set to 50 posts per page so only the 50 latest projects are shown. You can see this page here.
We provide a filter at the top of the page so visitors can choose between the two “services” and show only those posts. The problem is, the template for “taxonomy-services.php” does not work with query_posts, so we have no way to determine how many posts should be shown. By default, WP shows only the 10 latest posts for the selected taxonomy/category.
This is the code we use:
<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?> <!-- projects --> <div class="projects"> <ul class="hover_block"> <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <li><a href="<?php echo get_permalink(); ?>"><?php the_post_thumbnail( array(200,140) ); ?><h5><?php the_title(); ?></h5><?php echo cc_get_the_term_list($post->ID, 'services', ' ', ', ', '', 0); ?></a></li> <?php endwhile; wp_reset_query(); ?> </ul> </div>
As said, this works fine, but we would like to display more than the 10 latest posts (in fact, all posts if possible). We need some sort of overwrite for the WP defaults set in wp-admin. Any advice on how to accomplish this for custom taxonomies?
Thanks in advance,
- The topic ‘Set number of posts for custom taxonomy’ is closed to new replies.