Skip to content

Term Query Loop Block #49094

@tomjn

Description

@tomjn

What problem does this address?

Currently you can create a tag cloud, and there's a post term list, but these options are limited, and come in 2 versions ( one for the current post, and one that's just general ). If I need to build anything that deviates from this I'm forced to build a new block.

E.g. if I want to display terms with their term descriptions, or add a graphic next to each tag, sort terms into columns, etc, I can't do that with core blocks. Or even spread terms out in a row the same way a group/row block can.

e.g. creating this type of category list automatically is not possible with the core blocks:

Politics

News articles about politics

Sports

The latest sports news

What is your proposed solution?

Instead, A term query block similar to the post query block would be very useful, with term title, term description etc blocks.

This way the existing core blocks could be constructed in any shape form or layout by the users choice without writing code. E.g. using headings for tags with descriptions, custom term featured image blocks in plugins, adding icons, etc

Variants of the block could be registered for each taxonomy too:

Screenshot 2023-03-15 at 12 32 45

Proposed Plan

We have a couple of working examples of how these blocks could work (Terms Query plugin and a draft PR). However, as this work introduces multiple new blocks, it will be easier to work on and review if the work is split up.

We can use the first container block PR as a base feature branch, and then split the work up as follows:

Other features that could be follow-up PRs:

  • Modify the term description block to render the preview
  • Add variation picker and multiple layout variations
  • 'Show only child terms' option
  • Allow inheriting the terms query from the current template

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions