这是我的密码。
我基于CapitaineWP的结构和模板。我有。锅采购订单。mo和。json文件。
$script\\u asset\\u path=PERSO\\u文件夹"E/构建/索引。资产php“;;
如果(!file\\u exists($script\\u asset\\u path)){throw new\\Error(\'需要运行npm start
或npm run build
对于;创建块/perso chacha基地”;先阻止。(“..script\\u asset\\u path.”);}
$index_js = \'/build/index.js\';
$script_asset = require( $script_asset_path );
wp_register_script(
\'perso-chacha-bases-block-editor\',
PERSO_URL.$index_js,
$script_asset[\'dependencies\'],
$script_asset[\'version\']
);
wp_set_script_translations(
\'perso-chacha-bases-block-editor\',
\'perso-chacha\',
PERSO_FOLDER . \'/languages\'
);
$editor_css = \'/build/index.css\';
wp_register_style(
\'perso-chacha-bases-block-editor\',
PERSO_URL.$editor_css,
array(),
filemtime( PERSO_FOLDER.$editor_css )
);
$style_css = \'/build/style-index.css\';
wp_register_style(
\'perso-chacha-bases-block\',
PERSO_URL.$style_css,
array(),
filemtime( PERSO_FOLDER.$style_css )
);
register_block_type( \'create-block/perso-chacha-bases\', array(
\'editor_script\' => \'perso-chacha-bases-block-editor\',
\'editor_style\' => \'perso-chacha-bases-block-editor\',
\'style\' => \'perso-chacha-bases-block\',
) );