봄 여름 가을 겨울

어떤 이는

꿈을 간직하고 살고

어떤 이는~ spacer 30px 연습

이 정도가 spacer 30px

spacer default height 30px

In the child theme folder,

Create editor.js

Add some codes to the functions.php

editor.js

wp.domReady(function () {
    // 기존 variation 제거
    if (wp.blocks.unregisterBlockVariation) {
        wp.blocks.unregisterBlockVariation('core/spacer', 'default');
    }
    // 새로운 variation 등록
    wp.blocks.registerBlockVariation('core/spacer', {
        name: 'custom-default',
        attributes: {
            height: "30px" // 원하는 기본값(px)으로 수정
        },
        isDefault: true
    });
});

functions.php에 추가 할 코드

function mychild_enqueue_block_editor_assets() {
    wp_enqueue_script(
        'mychild-editor-js',
        get_stylesheet_directory_uri() . '/editor.js',
        array('wp-blocks', 'wp-dom-ready', 'wp-edit-post'),
        filemtime(get_stylesheet_directory() . '/editor.js'),
        true // footer에 로드
    );
}


add_action('enqueue_block_editor_assets', 'mychild_enqueue_block_editor_assets');

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *