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 WordPress Theme Development Custom Post Type Templates in WordPress The Portfolio Single Page

Description + images not appearing. Can't find a solution in other questions, help?

I've been working on this for ages, and have looked at the other questions but am failing to find a solution. I'm sure that I followed the tutorial correctly. Here's my code:

<?php get_header(); ?>

<section class="two-column row no-max pad">
  <div class="small-12 columns">
    <div class="row">

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

          <!-- Primary Column -->
          <div class="small-12 medium-7 medium-offset-1 medium-push-4 columns">
            <div class="primary">

              <?php the_field('images'); ?>

            </div>
          </div>

          <!-- Secondary Column -->
          <div class="small-12 medium-4 medium-pull-8 columns">
            <div class="secondary">

              <h1> <?php the_title(); ?> </h1>
              <p> <?php the_field('portfolio_description'); ?> </p>

            </div>
          </div>
        <?php endwhile; endif;  ?>
    </div>
  </div>
</section>

<?php get_footer(); ?>

Is there something I missed?

Bat Chen Seri
Bat Chen Seri
6,851 Points

I had the same problem, and I figured out the issue was that the file wasn't applied to the single portfolio pages at all.

I named the file "single-portfolio.php" like Zac did, while my custom post type was named "portfoliopage" rather than "portfolio" (since CPT didn't let me create a new post type named "portfolio"). So, for me, changing the file name to "single-portfoliopage.php" solved the problem.

1 Answer

Bradley Maravalli
Bradley Maravalli
8,927 Points

Hey man. Check out anthonyfajardo's comment. I had the same issue and following his advice worked if followed to a T.