• I’ve got a page where I am trying to display post types with custom fields.
    The custom field I am querying on is called ‘lead’.

    Effectively i’ve got:

    <?php query_posts("post_type=member&order=ASC");
    if ( have _posts()) : while(have_posts()) : the_post();
    
    $key = 'lead';
    $themeta = get_post_meta($post->ID, $key, true);
    if($themeta == 'yes') { ?>
    
    Do something
    
    <?php } endwhile; endif; wp_reset_query();?>
    
    <?php query_posts("post_type=member&order=ASC");
    if ( have _posts()) : while(have_posts()) : the_post();
    
    $key2 = 'lead';
    $themeta2 = get_post_meta($pos2t->ID, $ket, true);
    if($themeta2 == 'no') { ?>
    
    Do something else
    
    <?php } endwhile; endif; wp_reset_query();?>

    This is working fine, however it is only showing 10 results from each query. Is there anyway I can make it show ALL results from each query?

    The only that is puzzling me is that in the dashboard, the items span to 2 pages.

    There are 30 entries all together, 10 of them with the custom field ‘yes’ reside on page 2, and the other 20 with the custom field of ‘no’ are on the 1st page. Is this affecting things?

Viewing 1 replies (of 1 total)
  • You need to set ‘posts_per_page=-1’ in your queries to retrieve all posts, like this:

    <?php query_posts("post_type=member&order=ASC&posts_per_page=-1");

Viewing 1 replies (of 1 total)
  • The topic ‘WordPress query_post only displaying 10 results’ is closed to new replies.