Last updated
Requires PorterWP Premium. Adds faceted filtering to any core/Query Loop.
Insert “Filters” block.
Configure filter groups via the ACF sidebar:
Post Types, Taxonomies, Meta, Search, Sort.
Add a core/Query Loop block after the Filters block and give it the CSS class use-filters.
The Filters block outputs a hidden <form> which serialises field choices and triggers an AJAX refresh handled by Porter_Filters_Ajax_Handler.
includes/premium/filters/block/
Block source (block.json, ACF, SCSS, JS)
core-query--use-filters.php
Alters WP_Query based on submitted params
includes/premium/filters/traits/trait-FilterParser.php
Converts GET params ⇒ WP_Query arguments
includes/premium/filters/traits/trait-FilterGenerator.php
Builds HTML for facet groups
templates/
Legacy PHP templates fallback
assets/src/js/porter-filters.js listens for change events, debounces, then calls wp.ajax.send( 'porter_filters', … ).
The PHP handler returns rendered block markup which swaps the contents of the Query Loop container.
If the search field is enabled, themes can override its placeholder text without replacing the filter template:
See porter/filter/search_placeholder for the full hook reference.
Last updated
add_filter( 'porter/filter/search_placeholder', function( $placeholder, $key, $post_type, $filter_settings ) {
if ( 'resource' === $post_type ) {
return 'Search resources';
}
return $placeholder;
}, 10, 4 );