Filter WordPress Blocks

IntroductionIntroduction

WP Grid Builder enables native filtering of WordPress blocks, such as the Query Loop block. This allows you to easily apply facets directly within the WordPress editor to filter blocks seamlessly.

Currently, the following blocks can be handled by facets:

  • Query Loop block
  • Latest Posts block
  • Product Collection block (WooCommerce)

Filtering blocks is supported in both the WordPress editor and site editor. You can filter multiple blocks on a page by attaching facets to each block.

LimitationsLimitations

While filtering blocks works seamlessly, conflicts may arise when using (third-party) blocks that rely on JavaScript to interact with elements or blocks within the loop. For example, blocks that create tabs, toggles, accordions, etc., which depend on JavaScript, may not function correctly after filtering content. This means you might not be able to interact with these blocks in the loop after filtering, especially if the JavaScript responsible for the interactions does not properly delegate JS events.

PrinciplePrinciple

Attaching facets to the previously mentioned blocks is seamless and straightforward. Simply insert a facet block as usual, select the facet to filter the content, and choose the content to be filtered. WP Grid Builder will automatically list all available and compatible blocks in the facet dropdown menu, making it easy to select and apply filtering to those blocks

Filter Query Loop block
Filter Query Loop block