Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Only Displaying one portfolio article

I have followed the video and even download and used the code provided and all i get is one portfolio article on the grid page.

My Code:

<?php /* Template Name: Portfolio Grid */ ?> <? get_header(); ?> <div class="container"> <!-- Example row of columns --> <div class="row"> <div class="col-md-12"> <?php if (have_posts()): while (have_posts()): the_post()?>

      <div class="page-header">
        <h1><?php the_title();?></h1>
      </div>

       <?php the_content(); ?>

      <?php endwhile; else: ?>

      <div class="page-header">
        <h1>Oh No!</h1>
      </div>

      <p>No Content is appearing on this page!</p>

      <?php endif; ?>
    </div>

  </div>

<div class="row">

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

  ?>

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

<div class="col-sm-3 portfolio-piece"> <h3><?php the_title();?></h3> </div><!-- end col-sm-3 portfolio-piece -->

<?php endwhile; endif; ?> </div><!-- end row -->

<? get_footer(); ?>

2 Answers

Sue Dough
Sue Dough
35,800 Points

How many articles do you have?

Solved it and I fell really stupid. Setting > Readings > Blog pages show at most was set to 1.