#64414 closed enhancement (fixed)
Block visibility based on screen size: add backend block support
| Reported by: | ramonopoly | Owned by: | ramonopoly |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.0 |
| Component: | Editor | Version: | 7.0 |
| Severity: | normal | Keywords: | gutenberg-merge has-patch has-unit-tests add-to-field-guide needs-dev-note |
| Cc: | Focuses: |
Description
WordPress 7.0 with build upon the block visibility block support introduced in 6.9, with functionality to allow hiding a block based on screen size.
Here are the relevant issues:
To that end, the backend block supports capability needs to be implemented with the following scope:
Block visibility block supports: Define and document the blockVisibility attribute to support both boolean (hide everywhere) and object format (per-device visibility). Define breakpoints constants consistent with those in the editor.
Frontend CSS output: Create PHP block support that generates CSS media queries and applies .wp-block-hidden-[device] classes to blocks based on their visibility settings.
A corresponding Gutenberg patch exists to guide development.
See also:
Change History (5)
This ticket was mentioned in PR #10629 on WordPress/wordpress-develop by @ramonopoly.
7 months ago
#1
- Keywords has-patch has-unit-tests added
@ramonopoly commented on PR #10629:
5 months ago
#3
#4
@
5 months ago
- Keywords add-to-field-guide needs-dev-note added
This is worth mentioning in the Field Guide.
Also adding needs-dev-note just in case we can mention it in a more general note.
#5
@
4 months ago
- Type defect (bug) → enhancement
Dev note over here:
https://github.com/WordPress/gutenberg/issues/73776#issuecomment-3930808738
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This PR syncs the changes in https://github.com/WordPress/gutenberg/pull/73994. It:
displayproperty to thesafecss_filter_attrfunction.Unit tests:
To test manually, enable the experiment:
Then copy and paste this into your post editor, publish and view the frontend.
https://github.com/user-attachments/assets/45f86b73-f8f8-4763-a1eb-2303fda96105
Make sure to test with the experiment off as well. The last item should never show with the experiment on and off.