From 54942879998ab0fd99db94de0312403793241bed Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 12 Aug 2020 19:29:39 +0100 Subject: [PATCH] dynamically use theme and block slugs --- src/editor.scss | 2 +- src/style.scss | 2 +- svg.php | 33 ++++++++++++++++++--------------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/editor.scss b/src/editor.scss index 29e05d1..f18101f 100644 --- a/src/editor.scss +++ b/src/editor.scss @@ -4,6 +4,6 @@ * Replace them with your own styles or remove the file completely. */ -.wp-block-room-vw-svg { +.wp-block-- { // FIXME use correct class name border: 1px dotted #f00; } diff --git a/src/style.scss b/src/style.scss index 1de0373..9b8eaa3 100644 --- a/src/style.scss +++ b/src/style.scss @@ -4,7 +4,7 @@ * Replace them with your own styles or remove the file completely. */ -.wp-block-room-vw-svg { +.wp-block-- { // FIXME use correct class name background-color: #666; color: #fff; padding: 2px; diff --git a/svg.php b/svg.php index 78ba6b5..402ac1e 100644 --- a/svg.php +++ b/svg.php @@ -1,18 +1,22 @@ 'svg-block-editor', - 'editor_style' => 'svg-block-editor', - 'style' => 'svg-block', + register_block_type( "$theme_slug/$block_slug", array( + 'editor_script' => "{$block_slug}-block-editor", + 'editor_style' => "{$block_slug}-block-editor", + 'style' => "{$block_slug}-block", ) ); -} -add_action( 'init', 'svg_block_init' ); +} );