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 trialjazib shahzad
Courses Plus Student 268 PointsGetting error in single-portfolio.php file
Hey, I'm getting error in single-portfolio.php file on these lines:
1.<?php endwhile(); endif; ?>
2.<?php get_footer(); ?>
Can anyone detect why so?
<?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(); ?>
1 Answer
Crisoforo Gaspar Hernández
18,302 PointsLooks like you are calling endwhile
as a function you shouldn't call with the parenthesis, try with this:
<?php endwhile; endif; ?>
instead of
<?php endwhile(); endif; ?>
jazib shahzad
Courses Plus Student 268 Pointsjazib shahzad
Courses Plus Student 268 Pointsyeah!it worked. Thnx
Josh Miclette
Courses Plus Student 6,227 PointsJosh Miclette
Courses Plus Student 6,227 PointsGood catch Crisoforo.
Andres Ramirez
18,094 PointsAndres Ramirez
18,094 PointsThank you so much for adding this. The instructor clearly shows endwhile(); on the tutorial.
endwhile; works!