Guidance with The Loop for CMS

Strictly, you don’t need to use a loop in a page template, but it doesn’t hurt, the content of the page will still load, the loop will simply only run once as there is only one post/page. Many themes include a loop in page templates, I guess for some compability issue.

If you are building your page template from scratch, you don’t need to add a loop to it, you are right, wordpress will get the right content from the URL, but you still need to run the function the_post() before to use template tags like the_title(), the_content(), etc. Just put the the_post() towards the top of the template.

Hope it makes sense to you, don’t hesitate to ask if you need further clarifications.

Leave a Comment