8/10/2023 0 Comments Pattern blocks patternsRegister_block_pattern() should be called from a handler attached to the init hook. 'description' => _x( 'Two horizontal buttons, the left button is filled in, and the right button is outlined.', 'Block pattern description', 'my-plugin' ), The following code sample registers a block pattern named ‘my-plugin/my-awesome-pattern’: register_block_pattern( Pattern blocks are a classic and common resource found in early childhood classrooms as well as in. To hide a pattern so that it can only be inserted programmatically, set the inserter to false. Learning and Playing with Pattern Block Designs. inserter (optional): By default, all patterns will appear in the inserter.templateTypes (optional): An array of template types where the pattern makes sense e.g: ‘404’ if the pattern is for a 404 page, single-post if the pattern is for showing a single post.The pattern will only be available when editing one of the post types passed on the array, for all the other post types the pattern is not available at all. postTypes (optional): An array of post types that the pattern is restricted to be used with.Each value needs to be the declared block’s name. blockTypes (optional): An array of block types that the pattern is intended to be used with.viewportWidth (optional): An integer specifying the intended width of the pattern to allow for a scaled preview of the pattern in the inserter.keywords (optional): An array of aliases or keywords that help users discover the pattern while searching.A category must be registered separately in order to be used here. Block patterns can be shown on multiple categories. categories (optional): An array of registered pattern categories used to group block patterns.The description will help users discover the pattern while searching. A description is optional but it is strongly encouraged when the title does not fully describe what the pattern does. description (optional): A visually hidden text used to describe the pattern in the inserter.content (required): Block HTML Markup for the pattern.title (required): A human-readable title for the pattern.The properties available for block patterns are: – properties: An array describing properties of the pattern. – title: A machine-readable title with a naming convention of namespace/title. The register_block_pattern helper function receives two arguments. Theme and plugin authors can register additional custom block patterns using the register_block_pattern helper function. The editor comes with several core block patterns. – Block patterns contextual to block types and pattern transformations Once inserted into content, the blocks are ready for additional or modified content and configuration. Browse: Home / Block Editor Handbook / Reference Guides / Block API Reference / Patterns Patterns Editīlock Patterns are predefined block layouts, available from the patterns tab of the block inserter.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |