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

Armando Tinoco
Armando Tinoco
1,154 Points

Multiple Loops In Front Page

I am learning Wordpress and I am trying to understand how the Loop works. I have a website here (www.novelalounge.com) that I am trying to fix and code better and cleaner as I have been just kind of updating randomly.

The videos that talk about the Loop just kind of go over it and cover it really fast and I am interested in know how it will work as I have a layout where I want my posts to display in boxes as my site, but I am having trouble doing it in a manner that looks right.

The code for the Loop is really difficult to understand.

2 Answers

Matt Campbell
Matt Campbell
9,767 Points

If you're struggling with understanding the loop, do it in stages. First, write out one of what you want to show in just HTML & CSS.

Then, look at it and work out what you want repeated for each post, each box in your case, and wrap it in the loop. After that, replace each thing like the title with the_title() and the image with the_post_thumbnail();

Just build up slowly.

Armando Tinoco
Armando Tinoco
1,154 Points

Thank you Matthew. What I am most struggling with is the many ways to write the loop, and if I would have to write a loop for each box as I have it now. The thing is that I am having issues with my host as I have too many script request and it's overloading the host and causes it to crash from time to time. This is why I want to simplify the code and make it easier for the host to handle, which in turn will make the site load faster.