feat(carousel): add Terms Query block compatibility#98
Open
thomasnavarro wants to merge 3 commits intortCamp:developfrom
Open
feat(carousel): add Terms Query block compatibility#98thomasnavarro wants to merge 3 commits intortCamp:developfrom
thomasnavarro wants to merge 3 commits intortCamp:developfrom
Conversation
added 3 commits
March 26, 2026 21:32
Add support for the core/terms-query block inside carousels.
- CSS: flex/gap selectors for .wp-block-term-template and its children
- CSS: column variants (columns-2/3/4) for term-template
- JS (view.ts): detect .wp-block-term as slide and .wp-block-term-template
as Embla container on the frontend
- JS (useCarouselObservers): observe term-template for mutation/resize
- JS (edit.tsx): allow core/terms-query in viewport, mirror columns-N
class on term-template via MutationObserver in the editor
- PHP (Plugin.php): render_block filter to add columns-{N} class to
term-template output, bridging a parity gap with post-template in
Gutenberg core
- TS (types.ts): enrich BlockEditorSelectors.getBlocks return type
Verify isSlideActive correctly identifies .wp-block-term elements as individual slides within a Terms Query carousel.
- Rewrite terms-query.php pattern with valid Gutenberg markup: dynamic term-template block (no ul/li in saved content), carousel-slide wrapper, correct termQuery attributes - Add Terms Query to README features list and FAQ - Add Terms Query setup guide to USAGE.md
Author
|
I'm not 100% sure this is the best approach to work around the missing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for core/terms-query inside carousels. The Terms Query block now works as a content source alongside Query Loop and manual slides, with each term rendered as its own slide.
One catch: Gutenberg's term-template block doesn't add a columns-{N} class to its wrapper (unlike post-template). This PR fixes that server-side (PHP render_block filter) and editor-side (MutationObserver) so the carousel can detect the column count.
Type of change
Related issue(s)
Closes #97
What changed
.wp-block-term-templateand.wp-block-termselectors alongside existingpost-templateselectors for flex layout, gap, columns variants, loop mode and vertical axisview.tsdetects.wp-block-term-templateas Embla container and.wp-block-termas individual slides;useCarouselObservers.tsobserves term-template for mutation/resizeedit.tsxallowscore/terms-queryin the viewport, reads the term-template'scolumnCountfrom the block store, and mirrors thecolumns-{N}class via MutationObserver (persists across block select/deselect cycles)render_block_core/term-templatefilter inPlugin.phpaddscolumns-{N}class to the<ul>wrapper usingWP_HTML_Tag_Processor, bridging a parity gap withpost-templatein Gutenberg coreterms-query.phpwith valid Gutenberg markup — dynamicterm-templateblock (no<ul>/<li>in saved content),carousel-slidewrapper, correcttermQueryattributesisSlideActivetest for.wp-block-termslide detectionBreaking changes
Testing
Test details:
columnCountin term-template settings (2, 3, 4) — carousel updates in both editor and frontendcolumns-Nclass persists on the wrapper<ul class="wp-block-term-template columns-3">— class is present via PHP filternpm run test:js— all tests pass including new Terms Query testScreenshots / recordings
N/A — to be added during review.
Checklist