0

I have a custom post type called listings with different taxanomies, I am using this query to display first only my post that have the type taxonomy featured. This is the code that does that :

<?php
  query_posts( array( 'post_type' => 'listings','type' => 'featured' ) );
  if ( have_posts() ) : while ( have_posts() ) : the_post();
?>


<?php endwhile; endif; wp_reset_query(); ?>
<?php

I want this query to limit it self to the first page in wich i have 10 post

1 Answer 1

0

If your question is:

I want this query to limit it self to the first page in wich i have 10 post

I think adding a 'posts_per_page' => 10 array parameter will do the thing for you:

query_posts( array( 'post_type' => 'listings','type' => 'featured','posts_per_page' => 10 ) );

But above all, I'd like to recommend you to use WP_Query() instead, because of a Great cause. And moreover it will give you much ease with a lot of query arguments. And you can use a lot of them even in a single page, and with no danger.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.