0

I can get all my posts in the following loop to show except the last? There should be ten posts but it's only showing nine?

        <div class="row staff-board">

          <?php $staff01_args = array(
            'post_type'      => 'staffboard',
            'posts_per_page' => 3,
            'cat' => 4 ); ?>

            <?php $the_query = new WP_Query( $staff01_args ); ?>

            <?php if ( $the_query->have_posts() ) :
              while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
              <div class="large-4 medium-4 small-12 columns staff">
                <?php the_post_thumbnail('small-portrait'); ?>
                <?php the_content(); ?>
              </div><!-- /large-4 -->
            <?php endwhile; ?>
            <?php wp_reset_postdata(); ?>
          <?php endif; ?>

        </div>



        <div class="row staff-board">

          <?php $staff02_args = array(
            'post_type'      => 'staffboard',
            'posts_per_page' => 3,
            'offset' => 4,
            'cat' => 4 ); ?>

            <?php $the_query = new WP_Query( $staff02_args ); ?>

            <?php if ( $the_query->have_posts() ) :
              while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
              <div class="large-4 medium-4 small-12 columns staff">
                <?php the_post_thumbnail('small-portrait'); ?>
                <?php the_content(); ?>
              </div><!-- /large-4 -->
            <?php endwhile; ?>
            <?php wp_reset_postdata(); ?>
          <?php endif; ?>

        </div>

        <div class="row staff-board">

          <?php $staff03_args = array(
          'post_type'      => 'staffboard',
          'posts_per_page' => 3,
          'offset' => 7,
          'cat' => 4 ); ?>

          <?php $the_query = new WP_Query( $staff03_args ); ?>

          <?php if ( $the_query->have_posts() ) :
            while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
            <div class="large-4 medium-4 small-12 columns staff">

              <?php the_post_thumbnail('small-portrait'); ?>
              <?php the_content(); ?>
            </div><!-- /large-4 -->
          <?php endwhile; ?>
          <?php wp_reset_postdata(); ?>
        <?php endif; ?>

        </div>

        <div class="row staff-board">

          <?php $staff04_args = array(
          'post_type'      => 'staffboard',
          'posts_per_page' => 3,
          'offset' => 10,
          'cat' => 4 ); ?>

          <?php $the_query = new WP_Query( $staff04_args ); ?>

          <?php if ( $the_query->have_posts() ) :
            while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
            <div class="large-4 medium-4 small-12 columns staff">
              <?php the_post_thumbnail('small-portrait'); ?>
              <?php the_content(); ?>
            </div><!-- /large-4 -->
          <?php endwhile; ?>
          <?php wp_reset_postdata(); ?>
        <?php endif; ?>

        </div>
0

If you're offsetting each query to not show the previous 3 posts, your offsets are set wrong.

Try an offset: 3 on staff02_args and increment each succeeding query from there.

3, 6, 9

Instead of

4, 7, 10

  • @nobot-z No problem, if that solved your question would you mind marking the answer as accepted? – Rich Dec 10 '14 at 13:42
  • Yea sure no problem – nobot-z Dec 10 '14 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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