Skip to content

Conversation

@zamartz
Copy link

@zamartz zamartz commented Nov 21, 2025

Summary

  • Add limitToCurrentResults attribute and a “Show Terms in Current Results” toggle so taxonomy filters can optionally list only terms attached to posts in the current Query Loop.
  • Cache each Query Loop’s post IDs via the_posts (for both inherited and custom queries) and update the taxonomy block renderer to use those IDs when scoped filtering is enabled, falling back to the previous get_terms() behaviour when it’s off.
  • Add a Sort Filter block that mirrors the core Query Loop “Order by” controls, exposes preset order options, writes a single readable query-post_orderby parameter, and wires its dropdown into the interactivity store.
  • Standardize all filter/search/sort URLs around a single query-post_id + query-* parameter scheme (with legacy support) and keep the orderby:order string human‑readable instead of URL‑encoded.
  • Introduce a shared taxonomy‑text helper and compiled block that outputs dynamic with prefix/suffix controls, plus a RichText format (toolbar button + modal) that injects the same dynamic text inline in Paragraph/Heading copy.
  • Add “Page Number” and “Yoast Primary Category” filter sources, including “Only show after page 1” and “Link to term archive” toggles for page/Yoast modes.
  • Reinforce taxonomy pagination by redirecting ?query-page= URLs to /page/n, keeping the inline renderer aware of both forms, and adding a client‑side fallback when @wordpress/interactivity-router is unavailable.
  • Ship only compiled plugin assets by removing dev tooling (src/, npm manifests, node_modules) from the distributable package.

Notes

Testing

  • npm run build (before removing tooling files from the distributable).
  • Verify taxonomy filter dropdowns only list terms present in the current query results when “Show Terms in Current Results” is enabled, and list all terms when it’s off.
  • Verify the Sort Filter block updates the query using a single readable query-post_orderby parameter and preserves it as additional filters/search are applied.
  • Verify the taxonomy‑text block and inline format render the expected term title/description/page number or Yoast primary category, respect prefix/suffix, and honor the “Only show after page 1” and “Link to term archive” toggles.
  • Verify taxonomy archives use /page/n URLs while preserving existing query-* parameters, and that client‑side navigation still updates results correctly even if the interactivity router is unavailable.

@zamartz zamartz changed the title Add optional scoped taxonomy filter dropdown (expands on #29)Add “Show Terms in Current Results” option to taxonomy filter Partially (expands on #29)and adds new blocks and rich text for seo and copy on pages Nov 25, 2025
- add a valueType attribute plus inspector control so the block can output
  either the selected term’s title or its description (sort filters always
  use title), and update the PHP helper to return the correct sanitized value
- expand the RichText format modal with the same value-type dropdown, auto-
  insert a descriptive placeholder like “taxonomy tag description”, and update
  existing spans instead of inserting duplicates when re-editing
- rebuild the taxonomy-text editor script/assets and enqueue them so both the
  standalone block and inline format always reflect the new options
…compiled assets only

- Add limitToCurrentResults attribute and inspector toggle so taxonomy filters can optionally restrict choices to terms attached to posts in the current query loop.
- Cache each query loop’s post IDs via the_posts and use them when rendering taxonomy filters, falling back to get_terms() when the toggle is off.
- Introduce a Sort block that mirrors the Query Loop “Order by” UI, exposes preset order options, and renders a dropdown wired into the interactivity store.
- Add a shared taxonomy‑text helper and register the compiled block so authors can output dynamic <span class="taxonomy-text …"> with prefix/suffix controls.
- Add a RichText format + modal for inserting the same taxonomy text inline in Paragraph/Heading blocks, including value‑type (title/description/page) and page‑number support with “only show after page 1”.
- Add a Yoast primary category filter type with an optional “link to term archive” toggle for both block and inline format.
- Normalize filter/search/sort URLs around query-post_id + query-* parameters (with legacy support), ensure sort uses a readable query-post_orderby string, and keep pretty /page/n pagination in sync via redirect + history updates.
- Enqueue the taxonomy‑text editor assets in the block editor and add a router fallback so filters still work when the interactivity router is unavailable.
- Strip dev tooling (src/, npm manifests, node_modules) from the shipped package so only compiled plugin assets are deployed.
Adds support for displaying the current search term from WordPress search
queries (?s= parameter) in both the standalone taxonomy-text block and the
RichText inline format.

Changes:
- Add "search" to filterType enum in block.json
- Add "Searched Term" option to Filter Source dropdown in editor
- Extract search term from $_GET['s'] or get_query_var('s')
- Decode URL-encoded search terms (e.g., "garden+tools" → "garden tools")
- Hide Value Type and Link controls for search filter (search terms only
  support prefix/suffix, no description or link options)
- Update both edit.js (standalone block) and format.js (RichText format)

The search filter will display the searched term when a WordPress search
is active, allowing dynamic display of search queries in content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant