"While" Loop not working properly

On working with a non-profit organization, http://cloverareaassistance.org/about-us/who-we-are/, we are trying to display the board members. We have 12 Board Members of Custom Post Types in WordPress 4.2. Yet the code below only displays 10 of 12. :’( I don’t understand why it would limit at 10. If I change the order, I can verify that the two members that aren’t being displaying are correctly identified in the Board Members classification because they do appear if I change the menu order. What do I need to change to have all 12 display?

Thanks.

<?php get_header() ?> <?php $args = array( 'post_type' => 'staff', 'department' => 'staff', 'order' => 'menu_order' ); $staffquery = new WP_query( $args ); if ($staffquery->have_posts()): $staffmembers = '
'; $staffmembers .= '

Staff

'; while ($staffquery->have_posts()): $staffquery->the_post(); $url = get_the_post_thumbnail_url($post->ID); if ($url) { $staffmembers .= ''; } $staffmembers .= '
'.$post->post_title.'
'; $title = ''; $title = get_field('title', $post->ID); if($title) { $title .= ''.$title.''; } $term = get_field('term', $post->ID); if ($term) { $staffmembers .= '('.$term.')'; } $description = get_field('description', $post->ID); if ($description) { $staffmembers .= '
'.$description.'
'; } $email = get_field('email_address', $post->ID); if ($email) { $staffmembers .= '
'.$email.'
'; } $staffmembers .= '

'; endwhile; $staffmembers .= '
'; endif; $args = array( 'post_type' => 'staff', 'department' => 'board-of-directors', 'order' => 'ASC' ); $boardquery = new WP_query( $args ); if ($boardquery->have_posts()): while ($boardquery->have_posts()): $boardquery->the_post(); $boardmembers .= '
'; $url = get_the_post_thumbnail_url($post->ID); if ($url) { $boardmembers .= ''; } $boardmembers .= '
'.$post->post_title.'
'; $title = ''; $title = get_field('title', $post->ID); if($title) { $title = ''.$title.'
'; } $term = get_field('term', $post->ID); if ($term) { $term = '('.$term.')'; } $boardmembers .= '

'.$title.' '.$term.'

'; $description = get_field('description', $post->ID); if ($description) { $boardmembers .= '
'.$description.'
'; } $email = get_field('email_address', $post->ID); if ($email) { $boardmembers .= ''; } $boardmembers .= '
'; endwhile; $boardmembers .= ''; endif; ?> <?php if ( have_posts() ): the_post(); ?>
<?php if ( is_front_page() ) { ?> <?php } else { ?>

Its probably working fine, it’s just set to use pagination

Pagination Parameters
nopaging (boolean) - show all posts or use pagination. Default value is 'false', use paging.
posts_per_page (int) - number of post to show per page (available with Version 2.1, replaced showposts parameter). Use 'posts_per_page'=>-1 to show all posts (the 'offset' parameter is ignored with a -1 value). Set the 'paged' parameter if pagination is off after using this parameter. Note: if the query is in a feed, wordpress overwrites this parameter with the stored 'posts_per_rss' option. To reimpose the limit, try using the 'post_limits' filter, or filter 'pre_option_posts_per_rss' and return -1
posts_per_archive_page (int) - number of posts to show per page - on archive pages only. Over-rides posts_per_page and showposts on pages where is_archive() or is_search() would be true.
offset (int) - number of post to displace or pass over. Warning: Setting the offset parameter overrides/ignores the paged parameter and breaks pagination (Click here for a workaround). The 'offset' parameter is ignored when 'posts_per_page'=>-1 (show all posts) is used.
paged (int) - number of page. Show the posts that would normally show up just on page X when using the "Older Entries" link.
page (int) - number of page for a static front page. Show the posts that would normally show up just on page X of a Static Front Page.
ignore_sticky_posts (boolean) - ignore post stickiness (available with Version 3.1, replaced caller_get_posts parameter). false (default): move sticky posts to the start of the set. true: do not move sticky posts to the start of the set.</blockquote>

https://codex.wordpress.org/Class_Reference/WP_Query

Pounding head on desk, "why didn’t I think of that?"

That was the problem… thanks.

Sponsor our Newsletter | Privacy Policy | Terms of Service