@@ -6,8 +6,8 @@ applyTo: "**/{blocks,src/blocks}/**"
66
77## Block structure
88
9- Each block lives in its own directory under ` src/blocks/{{ block-name} }/ ` .
10- Built assets are output to ` blocks/{{ block-name} }/ ` .
9+ Each block lives in its own directory under ` src/blocks/{block-name}/ ` .
10+ Built assets are output to ` blocks/{block-name}/ ` .
1111
1212Typical block directory:
1313
@@ -26,9 +26,9 @@ Every block must have a `block.json` file with:
2626
2727- ` $schema ` : reference the WordPress block schema
2828- ` apiVersion ` : use ` 3 `
29- - ` name ` : ` {{PLUGIN_SLUG}} /block-name`
29+ - ` name ` : ` ls-plugin /block-name`
3030- ` title ` , ` description ` , ` category ` , ` icon `
31- - ` textdomain ` : ` {{TEXT_DOMAIN}} `
31+ - ` textdomain ` : ` ls-plugin `
3232- ` editorScript ` , ` style ` , ` viewScript ` as appropriate
3333- ` supports ` and ` attributes ` declarations
3434
@@ -38,12 +38,12 @@ Example:
3838{
3939 "$schema" : " https://schemas.wp.org/trunk/block.json" ,
4040 "apiVersion" : 3 ,
41- "name" : " {{PLUGIN_SLUG}} /my-block" ,
41+ "name" : " ls-plugin /my-block" ,
4242 "title" : " My Block" ,
4343 "category" : " text" ,
4444 "icon" : " block-default" ,
4545 "description" : " A short block description." ,
46- "textdomain" : " {{TEXT_DOMAIN}} " ,
46+ "textdomain" : " ls-plugin " ,
4747 "editorScript" : " file:./index.js" ,
4848 "style" : " file:./style.css" ,
4949 "supports" : {
@@ -58,7 +58,7 @@ Example:
5858Register blocks in the main plugin file or a dedicated ` inc/ ` file:
5959
6060``` php
61- register_block_type( {{NAMESPACE}}_PLUGIN_DIR . 'blocks/my-block' );
61+ register_block_type( LS_PLUGIN_PLUGIN_DIR . 'blocks/my-block' );
6262```
6363
6464Do not manually register scripts and styles when ` block.json ` handles it.
@@ -68,9 +68,9 @@ Do not manually register scripts and styles when `block.json` handles it.
6868For ` render_callback ` blocks:
6969
7070``` php
71- function {{PLUGIN_SLUG}}_render_my_block ( $attributes, $content, $block ) {
71+ function ls_plugin_render_my_block ( $attributes, $content, $block ) {
7272 $title = isset( $attributes['title'] ) ? sanitize_text_field( $attributes['title'] ) : '';
73- return '<div class =" wp-block-{{PLUGIN_SLUG}} -my-block" >' . esc_html( $title ) . '</div >';
73+ return '<div class =" wp-block-ls-plugin -my-block" >' . esc_html( $title ) . '</div >';
7474}
7575```
7676
0 commit comments