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 From Bootstrap to WordPress Create Bootstrap Styled Theme Templates From Bootstrap to WordPress Template: Part 2

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Getting current count inside the loop

I've passed the quiz for this section but this one question has me a little baffled.

The question is

If we are inside of a Loop and want to get the current count, we would write 
$the_query->  ____

in page-portfolio.php....

<?php $portfolio_count = $the_query->current_post + 1; ?>

I believe the answer lies there but it won't accept my answer.

1 Answer

Samuel Schumacher
Samuel Schumacher
5,259 Points

I think the answer for that question is just current_post. The only reason they add one to current_post in that loop seems to be to remove the zero-based count.