Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
FREELessons:11Length:1.2 hours

Next lesson playing in 5 seconds

  • Overview
  • Transcript

6.1 Conclusion

Finally, we’ll recap what’s been covered in the course. I hope you find your new knowledge of The Loop in WordPress to be useful for all your future website projects!

Related Links

6.1 Conclusion

Hello, and welcome back to this Tuts+ course on working with the WordPress Loop. In this part of the course, I'm gonna give you an overview of what we've covered during the course and give a recap of what you've learned. So we started off by taking a look at the WordPress Loop in action. And I showed you some of the pages in our site where it applies, which is all the pages, and how different loops are used on different pages. And then, I talked you through the code in the loop. So we looked at our loop.php file, and I showed you the code that is always in the loop, such as this line up here and this line down here, and the code in the middle, which will output the content on the page. We then moved on to looking at how to code the loop in an archive file. So we opened our archive file, which calls the loop include file using get_template_part. And then we looked at setting up some custom code for archives, and for the main blog page as well. We then looked at the loop in single posts and pages. And we created a loop file specifically for single posts and pages, and made some edits to the main loop in order to make that work better for that content type. After doing that, we moved onto modifying the loop. So I showed you first how to create a copy of the loop for a custom post type. So here I added the get term list for that post type. And then I showed you a rather more nifty way of editing the loop in a plug-in. So in our plug-in where we registered our post type projects, we added a function using the pre get posts hook in WordPress to modify the main query on particular post type archives. We then went on to looking at creating completely custom loops. So first I ran through the different methods there are of doing that, and then going back to our theme, we created two completely custom loops. The first of those was in our single.php file, and that used get posts to output a list of the latest posts. And we then looked at the WP query class, and in our page template file, we use WP query to output the same list of the latest posts. So as well as looking at the standard loop in WordPress and how it works in template files, you also learn how to create customized and tweaked loops, as well as completely bespoke and brand new loops in your theme template files. You can use what you've learned to create all sorts of loops, both using the main query in your template files, and also using, for example, the WP query class to create new loops and additional loops on your page, which you can do not only on your template files, but also in plug ins. I hope you found this course useful. Thanks for watching.

Back to the top