Przejdź do głównej zawartości

Developers

[sieve]

Renders a complete, self-contained filter: facets, results grid, sorting, active-filter chips and pagination. It reads the current filter state from the URL (sf_* query vars), so the initial render is server-side and shareable.

The Sieve Filter block (sieve/filter) is a dynamic block that renders the same widget as the shortcode. Add it from the block inserter.

Filter state lives in the URL so it is bookmarkable and back-button safe:

  • sf_<facet> - a facet’s selected values (comma-separated; min-max for a range).
  • sf_q - the search query.
  • sf_orderby - the sort order.
  • sf_paged - the current page.

POST /wp-json/sieve/v1/filter

Public, read-only endpoint that powers AJAX filtering. Body: { "query": { "sf_product_cat": "hoodies", "sf_orderby": "price" } }. Returns the rendered fragments (facets_html, toolbar_html, results_html, pagination_html), the result count and found. The frontend swaps these in place.

Admin endpoints (capability manage_woocommerce):

  • GET/POST /wp-json/sieve/v1/settings - read or save the facet configuration.
  • GET /wp-json/sieve/v1/catalog - the auto-discovered facet sources.
  • POST /wp-json/sieve/v1/reindex - rebuild the index.

Sieve fires an action after it boots, so an extension can register additional services in the shared container:

add_action( 'sieve/booted', function ( \Sieve\Plugin $plugin ) {
// Extend the container or register your own hooks.
} );