Created
October 22, 2022 11:27
-
-
Save frantorres/c455b8f5f654ae46e512bd75fd725bfc to your computer and use it in GitHub Desktop.
Añadir variación de bloque en Gutenberg.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
(function () { | |
const {__, _x, _n, _nx} = wp.i18n; | |
wp.blocks.registerBlockVariation( | |
'core/paragraph', | |
{ | |
name: 'paragraph-variation', | |
title: __('Variación de párrafo', '_s'), | |
icon: 'star-filled', | |
attributes: { | |
className: 'paragraph-variation' | |
}, | |
} | |
); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'enqueue_block_editor_assets', '_s_loadVariationsScript' ); //Variations of blocks. | |
function _s_loadVariationsScript(){ | |
wp_enqueue_script( | |
'_s-block-variations', | |
get_stylesheet_directory_uri() . '/block-variations.js', | |
array( 'wp-blocks', 'wp-i18n' ) | |
); | |
wp_set_script_translations( '_s-block-variations', '_s', get_template_directory().'/languages' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment