Saturday, May 21st, 2022

Guide to the New Query Loop Block • WPshout

I was talking with current students at the Up and Running Bootcamp last week about the new query block in WordPress 5.8. I have to admit that I didn’t really play with it much myself. For this reason, I was quite excited that when I sat down to share with you all the post this morning, I found this great little guide to it that Justin Tadlock put together a few weeks ago at WP Tavern .

For those who aren’t comfortable with the name of this block yet, here’s a great summary from Justin:

The word “query” is simpler than you think. It simply means “querying” or “asking” for posts from the database according to a defined set of options. For example, one might try to get the last 10 blog posts.

“Loop” is an even easier concept to understand. This means to “loop” or “cycle” through each query post and output it. Technically, a developer can do other things than just display the post during this process, but we’re only concerned with getting it printed on the screen.

The two things combined make up a query loop block. It allows users to ask for a set of posts and display each one.

Source link