WordPress 5.8, anticipated to be released in July, takes the next step towards Full Site Editing. This release includes the Query Loop and Page List blocks, which introduce the concept of displaying content dynamically and allow you to build dynamic layouts using new WordPress core blocks.

WordPress’s plan for Full Site Editing is to eventually allow users to build all parts of their sites without any PHP using blocks. This includes full control over your page, single post, archive, and 404 templates, as well as areas formerly controlled by themes, such as headers, footers, and sidebars. It will make the WordPress admin function more like theme or page builders.

The Full Site Editing roadmap is still vague with many future release dates still listed as “To Be Confirmed,” but WordPress 5.8 provides a glimpse of the new Full Site Editing experience with several features that are paving the way:

  • Collections of block layouts called Patterns, plus a growing Pattern Directory
  • Block-based widget editor
  • Block-based template editor for landing pages
  • New blocks for displaying theme information like your logo and site tagline (to use in templates)
  • New blocks for displaying dynamic content (to use with the new Query Loop block)

What is the Query Loop Block (and Page List Block)?

The most unfamiliar feature in WordPress 5.8 for many users is the Query Loop block.

The Query Loop block allows you to display dynamic lists of posts, pages, or custom post types from elsewhere on your site. Best of all, you can do it without the custom PHP coding that was previously required.

Because the lists you create are dynamic, they update automatically as you add, edit, or remove content from your site.

Uses for the Query Loop Block

Here are some things you can do with the Query Loop block:

Show recent posts on your homepage

Example of recent posts

Show posts with same category or tag

Show content from custom post types such as testimonials or portfolio items on your homepage

An example of testimonials

The Posts List block is simply an alias of the Query Loop block (if you add a Posts List block, you’ll actually see the Query Loop block on your page), so they share the same functionality.

WordPress 5.8 also includes another similar block called Latest Posts. This block only lists posts and includes a handful of preset options you can turn on or off. This means it’s missing some of the other options and flexibility you get with the Query Loop or Page List blocks.

How to Use the Query Loop Block

To use the Query Loop block, simply add the block to the page or post where you want the list to appear. The Query Loop block includes 6 pre-configured layouts to choose from.

You can page through the layout options or see them in a grid view when you first insert the block.

An example of layouts with 5.8

Or, you can Start blank and build a custom list using the variety of new dynamic blocks included in WordPress 5.8: Post Featured Image, Post Title, Post Content, Post Date, Post Excerpt, Post Categories, Post Tags.

An example of block options with 5.8

In the sidebar, choose which content you want to display. You can choose to display pages, posts, or custom post types.

A look at display settings in 5.8

The Query Loop block settings include ways to further customize what gets displayed. You can also choose how to order the items in your list, add filters to only show certain items, and choose to include or exclude sticky posts.

In the block toolbar, there are more settings. 

For instance, you can choose how many items to display per page. This feature, paired with the new Pagination block, breaks up a very long list into several sections and allows you to emphasize only the most recent or relevant items.

Similarly, if you only want to show the first few items, you can specify the maximum number to show, which limits the overall number that appears in the list.

Another option is to offset your list. This skips over the specified number of items and only displays list items after that. This is especially useful if you have a layout that displays a featured article elsewhere on the page and you don’t want to repeat it in your list.

In the following screenshot, we have a custom layout with a Query Loop block set to a max limit of 1 to show the most recent article as a larger, featured article. In a column on the right, we have another Query Loop block offset by 1 to list the later articles.

With WordPress 5.8, you can only use the Query Loop block in a post or page body. Eventually with Full Site Editing, you’ll be able to use it in single post templates and other templates like archives.

Limitations of Query Loop Block in WordPress 5.8

While all these features are an exciting step towards Full Site Editing, it’s still very basic and names and features are still in development. This may mean the Query Loop block is not entirely usable depending on what your site needs.

Styling Options

With WordPress 5.8, the styling options of the Query Loop and related dynamic blocks are limited to basic typography and color customizations.

Anything more advanced, such as changing the margins or padding, adding borders or box shadows, and adjusting letter spacing, just isn’t possible in the current version.

Filtering Options

Filters allow you to only display list items that meet certain criteria, for instance, posts that are part of the same category or tag. With WordPress 5.8, you can only filter by category, tag, keyword, or author.

For instance, if you have custom taxonomies set up on your site, you won’t be able to filter by those values. As a result, you’re not able to take full advantage of your site’s custom structures, and you’re limited to only displaying content in standard fields.

Block Options

The seven new blocks for displaying dynamic content are a nice start, but limiting the dynamic functionality to only seven blocks misses some other key blocks that could benefit from dynamic functionality.

One notable oversight is the Button block. Without dynamic functionality, you’re stuck with static calls to action since you can’t create buttons that dynamically link to the correct page. Instead, you have to add the correct URL to each button individually.

Advanced Options

Because WordPress 5.8 is the first introduction of the Query Loop block, it’s missing out on a lot of advanced features that already come standard in other dynamic content plugins. Things like:

  • Displaying content from custom fields or post relationships
  • Adding front-end filters and custom search fields
  • Displaying content as carousels, maps, masonry layouts, etc.

Plugins with Advanced Query Loop Functionality

If you’re excited about the possibilities of displaying content dynamically without coding but disappointed by the limitations of the Query Loop block, there are other options available. This is a feature that other plugins have been perfecting for a long time.

The following plugins combine the dynamic content functionality with the more advanced features that WordPress 5.8 is missing. Plus, all of these plugins are already compatible with Gutenberg and the Block Editor.

Toolset is a powerful suite of plugins that includes the View Block. This block is responsible for dynamically displaying any type of content – posts, pages, custom post types, standard and custom taxonomies, and content from post relationships – in completely custom layouts with front-end search and filter functionalities. Toolset’s dynamic content capabilities also integrate with WordPress core blocks and other block plugins to supercharge your entire block library.

If you only need to display posts, PostX – Gutenberg Blocks for Post Grid offers an abundance of layouts, including sliders, grids, carousels, and more. This makes it great for magazine, news, and blog sites. You can also build archives, display custom taxonomies, add pagination, and build advanced queries.

JetEngine by Crocoblock started as a way to add dynamic functionality to Elementor, and it now works great with Gutenberg, too. Display custom post types, taxonomies, custom fields, and post relationships using a variety of layouts: grid, slider, map, calendar, or even mix and match. With their Dynamic Widgets, you can display images, links, meta, and more.

Leave Your Feedback

You can try the new Query Loop block and other new features in the WordPress 5.8 Release Candidate. Leave a comment below and let us know if you’ve tried any of the alternatives listed in this article and how they compare with what WordPress has planned.

The post What is WordPress 5.8’s Query Loop Block? appeared first on Torque.

WordPress Agency

[ continue ]