=== Responsive Columns === Contributors: specia1ne Donate link: https://specia1ne.com Tags: gutenberg, block-editor, columns, responsive, css-grid Requires at least: 6.4 Tested up to: 6.8 Requires PHP: 7.4 Stable tag: 1.1.1 License: GPL-2.0-or-later License URI: https://www.gnu.org/licenses/gpl-2.0.html Adaptive column counts, gap controls, and Masonry layouts for core Columns and Query Loop blocks — no custom blocks required. == Description == > **See exactly how many columns appear on every device.** Responsive Columns extends the core Columns block and the Query Loop (grid) template with precise controls for four breakpoints, X/Y gap management, and an optional Masonry layout. ### Key features * **Four responsive breakpoints.** Fine-tune Desktop, Tablet landscape, Tablet portrait, and Mobile column counts (1–6 columns). * **Theme-aware gaps.** Uses your theme's block gap as a starting point and lets you override horizontal and vertical spacing independently. * **One-click Masonry for Query Loop (Grid).** No jQuery, automatically reflows posts as your content changes. * **Native block experience.** Works directly inside core/Columns and core/Post Template (grid) so patterns, reusable blocks, and theme.json continue to work. * **Lightweight.** Modern ES modules (~4 kB compressed) and CSS custom properties. Editor assets load only when needed. ### How it works The plugin adds a `has-s1-rc-columns` class and a handful of CSS custom properties: --s1-rc-columns-mobile-portrait --s1-rc-columns-mobile-landscape --s1-rc-columns-tablet-portrait --s1-rc-columns-tablet-landscape --s1-rc-columns-desktop /* auto-added for Masonry / --s1-rc-gap-x / horizontal / --s1-rc-gap-y / vertical, falls back to X */ Your theme's layout styles stay in control — Responsive Columns only adjusts `grid-template-columns` and gap values inside media queries. Disable or uninstall the plugin and the columns fall back to WordPress defaults without leaving orphan styles behind. ### Editor experience * Inspector panel with device icons, tooltips, and numeric inputs for precise values. * Theme gap detection with a reset button to restore defaults in one click. * Gap linking lets you mirror vertical spacing or split it into a custom row gap. * Masonry toggle explains prerequisites (Query Loop + Grid layout with a desktop column count). ### Accessibility & localisation * All UI controls are keyboard accessible and include human-readable labels. * Strings are translation ready via the `responsive-columns` text domain and JSON translation support. == Installation == 1. Upload the plugin folder to `/wp-content/plugins/` or search “Responsive Columns” in *Plugins → Add New*. 2. Activate the plugin. 3. Select a **Columns** block or **Query Loop → Grid**, open the sidebar, and expand the **Responsive Columns** panel. == Frequently Asked Questions == = Does it work with Reusable Blocks and Patterns? = Yes. Responsive settings are saved as native block attributes and persist across reusable blocks, synced patterns, and template parts. = Will my layout break if I uninstall the plugin? = No. Extra attributes are ignored by core blocks once the plugin is removed. Your content reverts to the default responsive behaviour (stacking on smaller screens). == Screenshots == 1. Four-column grid on desktop with Responsive Columns panel open. 2. Two-column tablet view showing adjusted breakpoints. 3. Single-column mobile view after resizing slider. == Changelog == = 1.1.1 = * **Fixes & Defaults:** “Reset responsive settings” now restores gap values directly from the active theme (`theme.json`). New blocks initialize with the correct default gap from the theme or a reliable fallback (`24px`). * **UX Improvements:** Column and row gaps now stay synchronized consistently when linked (X ↔ Y). Editor controls always display real pixel values based on the theme rather than placeholders. * **Masonry Guard:** Added a responsive validation layer that only enables Masonry for valid Query Loop grid layouts. The toggle now includes clear inline guidance and automatic reset behavior when prerequisites are not met. = 1.1.0 = * **Security & Stability:** Reworked the HTML filter to use `WP_HTML_Tag_Processor` instead of regex, ensuring safe and predictable markup updates. Hardened asset loading — scripts now read dependencies and versions directly from `index.asset.php` with graceful fallbacks. * **Quality & Performance:** Optimized front-end Masonry with clamped gap values, rate-limited resize handling, and automatic observer cleanup to prevent layout thrashing. Streamlined attribute updates in the editor inspector, reducing redundant renders and simplifying logic. * **Accessibility & i18n:** Added clearer screen-reader descriptions for gap sliders and improved help text for Masonry controls. Verified full localization support. = 1.0.0 = * Initial public release — breakpoints, gap controls, and Masonry option. == Upgrade Notice == = 1.1.1 = This patch improves theme gap detection, default handling, and Masonry reliability while keeping existing layouts visually unchanged. = 1.1.0 = This update improves code safety, performance, accessibility, and build stability without changing any existing functionality.