'carhop-blocks', 'title' => __('Blocs Carhop ', 'carhop-blocks'), 'icon' => 'heart', ], ], $categories ); } add_action('block_categories_all', 'carhop_add_block_categories', 25, 2); ##### CUSTOM BLOCKS SETTINGS ##### require_once __DIR__ . '/src/audio-player/audio-player.php'; /* ---------------------------------------------------------------- ##### ENQUEUE BLOCKS ------------------------------------------------------------------*/ function carhop_register_blocks() { if (!function_exists('register_block_type')) { return; } register_block_type(__DIR__ . '/acf-blocks/gallery'); register_block_type(__DIR__ . '/acf-blocks/social-networks'); register_block_type(__DIR__ . '/acf-blocks/custom-video'); register_block_type(__DIR__ . '/acf-blocks/team-carhop'); // Enregistrer le script pour le bloc gallery wp_register_script( 'carhop-gallery-view', plugins_url('acf-blocks/gallery/view.js', __FILE__), array(), filemtime(__DIR__ . '/acf-blocks/gallery/view.js'), true ); } add_action('init', 'carhop_register_blocks'); /* ---------------------------------------------------------------- ##### EDITOR EXTENSIONS ------------------------------------------------------------------*/ /** * Étend le bloc Titre (core/heading) avec un attribut "carhopVariant" * et ajoute une interface pour choisir une variante (ajoute une classe CSS). */ function carhop_enqueue_editor_assets() { $script_path = __DIR__ . '/src/core-heading-variant/editor.js'; if (!file_exists($script_path)) { return; } wp_enqueue_script( 'carhop-heading-variant', plugins_url('src/core-heading-variant/editor.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-dom-ready', 'wp-components', 'wp-compose', 'wp-data', 'wp-hooks', 'wp-i18n', 'wp-block-editor', 'wp-edit-post'), filemtime($script_path), true ); } add_action('enqueue_block_editor_assets', 'carhop_enqueue_editor_assets');