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

Jeffrey Cunningham
Jeffrey Cunningham
5,592 Points

My code is not displaying the image.

I followed the creation of single-portfolio.php file step by step but my image does not display in the primary column. This is the code I'm using.

<?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( 'description' ); ?></p>

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

<?php get_footer(); ?>

Note that I did remove the () from the close of the while loop. This is because I was receiving a parse error if I left in endwhile();

Thanks in advance for any help I receive.

Phil Purves
Phil Purves
9,827 Points

at a glance - looks like you need an extra closing /div just before /section ... worth a try?

Jeffrey Cunningham
Jeffrey Cunningham
5,592 Points

Thank Phil but I that is not the problem. it must be coming from a setting elsewhere. I have tried using there final theme's code supplied in the lesson downloads and it still does not display.

5 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Jeffrey Cunningham I noticed you have another post also having trouble displaying images. Did you get this fixed?

Jeffrey Cunningham
Jeffrey Cunningham
5,592 Points

No I did not, I will follow the instruction you listed in the other post and get back to you there.

Phil Purves
Phil Purves
9,827 Points

I recall having some trouble with that course section. I had to leap forward a couple of steps to find a finished code example to work backwards from - to figure out what the problem was. I think a few people were getting snagged on (perhaps) something missed out by Zac thereabouts. Good luck.

Jeffrey Cunningham
Jeffrey Cunningham
5,592 Points

Thank you phil. It must be some option in the dashboard, it is definitely not my code. I have even used the code from the final project folder and it still does not show the image.

Does anyone know any setting in dashboard that could prevent these images from appearing?

William Cousin
William Cousin
3,790 Points

I have this same issue. Code seems to be correct but images are not showing on 'Suggest' page of PHP website project.