You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -12,7 +12,11 @@ Users have the ability to lock and unlock blocks via the editor. The locking UI
12
12
13
13

14
14
15
-
Keep in mind that each block you want to lock will need to be individually locked as desired. There is not a way to mass lock blocks currently.
15
+
Keep in mind that you can apply locking options to blocks nested inside of a containing block by turning on the "Apply to all blocks inside" option. However, you cannot mass lock blocks otherwise.
16
+
17
+
**Lock the ability to edit certain blocks**
18
+
19
+
Alongside the ability to lock moving or removing blocks, the [Navigation Block](https://github.com/WordPress/gutenberg/pull/44739) and [Reusable block](https://github.com/WordPress/gutenberg/pull/39950) have an additional capability: lock the ability to edit the contents of the block. This locks the ability to make changes to any blocks inside of either block type.
16
20
17
21
**Apply block locking to patterns or templates**
18
22
@@ -126,31 +130,31 @@ Since theme.json acts as a configuration tool, there are numerous ways to define
@@ -278,6 +282,52 @@ When using theme.json in a block or classic theme, these settings will stop the
278
282
279
283
To enable something from the above, just set whatever value you want to change to `true` for more granularity.
280
284
285
+
## Limiting interface options with theme.json filters
286
+
287
+
The theme.json file is a great way to control interface options, but it only allows for global or block-level modifications, which can be limiting in some scenarios.
288
+
289
+
For instance, in the previous section, color and typography controls were disabled globally using theme.json. But let's say you want to enable color settings for users who are Administrators.
290
+
291
+
To provide more flexibility, WordPress 6.1 introduced server-side filters allowing you to customize theme.json data at four different data layers.
292
+
293
+
-`wp_theme_json_data_default` - Hooks into the default data provided by WordPress
294
+
-`wp_theme_json_data_blocks` - Hooks into the data provided by blocks.
295
+
-`wp_theme_json_data_theme` - Hooks into the data provided by the current theme.
296
+
-`wp_theme_json_data_user` - Hooks into the data provided by the user.
297
+
298
+
In the following example, the data from the current theme's theme.json file is updated using the `wp_theme_json_data_theme` filter. Color controls are restored if the current user is an Administrator.
299
+
300
+
```
301
+
// Disable color controls for all users except Administrators.
302
+
function example_filter_theme_json_data_theme( $theme_json ){
The filter receives an instance of the `WP_Theme_JSON_Data class` with the data for the respective layer. Then, you pass new data in a valid theme.json-like structure to the `update_with( $new_data )` method. A theme.json version number is required in `$new_data`.
328
+
329
+
Read more about this functionality in the [Filters for theme.json data dev note](https://make.wordpress.org/core/2022/10/10/filters-for-theme-json-data/).
330
+
281
331
## Remove access to functionality
282
332
283
333
**Remove access to the template editor**
@@ -300,11 +350,13 @@ To fully remove patterns bundled with WordPress core from being accessed in the
300
350
301
351
## Utilizing patterns
302
352
303
-
**Prioritize post content patterns for new pages**
353
+
**Prioritize starter patterns for any post type**
354
+
355
+
When a user creates new content, regardless of post type, they are met with an empty canvas. However, that experience can be improved thanks to the option to have patterns from a specific type prioritized upon creation of a new piece of content. The modal appears each time the user creates a new item when there are patterns on their website that declare support for the `core/post-content` block types. By default, WordPress does not include any of these patterns, so the modal will not appear without at least two of these post content patterns being added.
304
356
305
-
When a user creates a page, they are met with an empty page. However, that experience can be improved thanks to the option to have patterns from a specific type prioritized upon page creation in a modal. The modal appears each time the user creates a new page when there are patterns on their website that declare support for the core/post-content block types. By default, WordPress 6.0 does not include any of these patterns, so the modal will not appear without some of these post content patterns being added.
357
+
To opt into this, include `core/post-content` in the Block Types for your pattern. From there you can control which post types the pattern should show up for via the Post Types option. [Here's an example of a pattern](https://gist.github.com/annezazu/ead4c4965345251ec999b716c0c84f32) that would appear when creating a new post.
306
358
307
-
Read more about this functionality in the [Page creation patterns in WordPress 6.0 dev note](https://make.wordpress.org/core/2022/05/03/page-creation-patterns-in-wordpress-6-0/).
359
+
Read more about this functionality in the [Page creation patterns in WordPress 6.0 dev note](https://make.wordpress.org/core/2022/05/03/page-creation-patterns-in-wordpress-6-0/) and [note that WordPress 6.1 brought this functionality to all post types](https://make.wordpress.org/core/2022/10/10/miscellaneous-editor-changes-for-wordpress-6-1/#start-content-patterns-for-all-post-types).
308
360
309
361
**Lock patterns**
310
362
@@ -330,3 +382,4 @@ Keep in mind that the above approaches can be combined as you see fit. For examp
330
382
331
383
-[Builder Basics – Working with Templates in Full Site Editing (Part 3)](https://wordpress.tv/2022/05/24/nick-diego-builder-basics-working-with-templates-in-full-site-editing-part-3/)
332
384
-[Core Editor Improvement: Curated experiences with locking APIs & theme.json](https://make.wordpress.org/core/2022/02/09/core-editor-improvement-curated-experiences-with-locking-apis-theme-json/)
385
+
-[Learn WordPress session on Curating the Editor Experience](https://wordpress.tv/2022/07/22/nick-diego-curating-the-editor-experience/)
Show minutes required to finish reading the post. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-time-to-read))
590
+
591
+
-**Name:** core/post-time-to-read
592
+
-**Category:** theme
593
+
-**Supports:**~~html~~, ~~multiple~~
594
+
-**Attributes:** textAlign
595
+
587
596
## Post Title
588
597
589
598
Displays the title of a post, page, or any other content-type. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-title))
0 commit comments