0

I have a page that is supposed to show all of my portfolio posts but it only shows the first 10, I have no idea why

<div class="row">

          <?php
            $args = array( 
              'post_type' => 'portfolio'
            );
            $the_query = new WP_Query( $args );

          ?>

          <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

          <div class="col-xs-3 portfolio-piece">
              <h3 style="color:#1B7B98; text-align:center;">
                <?php the_title(); ?>
              </h3>

              <?php

                $thumbnail_id = get_post_thumbnail_id(); 
                $thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, 'thumbnail-size', true );
              ?>

              <p><a href="<?php the_permalink(); ?>"><img src="<?php echo $thumbnail_url[0]; ?>" alt="<?php the_title();?> graphic"></a></p>


          </div>

          <?php $portfolio_count = $the_query->current_post + 1; ?>
          <?php if ( $portfolio_count % 4 == 0): ?>

          </div><div class="row">

          <?php endif; ?>


          <?php endwhile; endif; ?>


        </div>
2

Try to change your following array

 $args = array( 
              'post_type' => 'portfolio'
            );

Use your array like this

 $args = array( 
                  'post_type' => 'portfolio',
                  'posts_per_page' => -1  //It will display all of your posts
                );

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.