fixing block inclusion
This commit is contained in:
parent
0ed7d007ae
commit
5cddb819b8
|
|
@ -1,101 +1,48 @@
|
|||
<?php
|
||||
|
||||
|
||||
// ##### Blocks Category 🡒 Déclaration de la catégorie de blocks custom
|
||||
function client_add_block_categories($categories)
|
||||
/* ---------------------------
|
||||
BLOCKS CATEGORY
|
||||
---------------------------*/
|
||||
function lhoist_add_block_categories($categories)
|
||||
{
|
||||
return array_merge(
|
||||
|
||||
[
|
||||
[
|
||||
'slug' => 'client-blocks',
|
||||
'title' => 'Client Generic Blocks ',
|
||||
'slug' => 'lhoist-content-blocks',
|
||||
'title' => 'lhoist blocks ',
|
||||
'icon' => 'heart',
|
||||
],
|
||||
[
|
||||
'slug' => 'client-pages',
|
||||
'title' => 'Client Specific Page Blocks ',
|
||||
'icon' => 'admin-page',
|
||||
],
|
||||
|
||||
],
|
||||
$categories
|
||||
);
|
||||
}
|
||||
add_action('block_categories_all', 'client_add_block_categories', 10, 2);
|
||||
add_action('block_categories_all', 'lhoist_add_block_categories', 10, 2);
|
||||
|
||||
|
||||
// ##### Blocks 🡒 Déclaration des blocks acf custom
|
||||
/* ---------------------------
|
||||
REGISTER ACF BLOCKS
|
||||
---------------------------*/
|
||||
|
||||
function acf_custom_client_blocks_init()
|
||||
|
||||
|
||||
function lhoist_content_blocks_init()
|
||||
{
|
||||
if (function_exists('acf_register_block_type')) {
|
||||
if (!defined('ABSPATH')) exit; // Exit if accessed directly.
|
||||
|
||||
// // ##### Home 🡒 Hero Section
|
||||
// acf_register_block_type(array(
|
||||
// 'name' => 'home_header',
|
||||
// 'title' => __("Home — Section d'accueil"),
|
||||
// 'description' => __("Brique pour la section d'acccueil"),
|
||||
// 'render_template' => 'template-blocks/home/home_header/home_header.php',
|
||||
// 'category' => 'client-blocks',
|
||||
// 'multiple' => false,
|
||||
// 'mode' => 'auto',
|
||||
// 'align' => 'full',
|
||||
// 'icon' => 'schedule',
|
||||
// 'supports' => array(
|
||||
// 'multiple' => false,
|
||||
// 'align' => ['full'],
|
||||
// 'jsx' => true
|
||||
// ),
|
||||
// // 'enqueue_style' => get_template_directory_uri() . '/template-parts/blocks/testimonial/testimonial.css',
|
||||
// // 'enqueue_script' => get_template_directory_uri() . '/template-parts/blocks/testimonial/testimonial.js',
|
||||
// // 'enqueue_assets' => function(){
|
||||
// // wp_enqueue_script( 'latest_articles_js', get_stylesheet_directory_uri() . '/template-parts/blocks/home/latest_articles/latest_articles.js');
|
||||
// // },
|
||||
|
||||
// ));
|
||||
// Statics
|
||||
register_block_type(get_template_directory() . '/blocks/search-and-find/build');
|
||||
|
||||
// ##### Home 🡒 Latest Articles
|
||||
acf_register_block_type(array(
|
||||
'name' => 'latest_articles',
|
||||
'title' => __("Derniers Articles"),
|
||||
'description' => __("Brique pour afficher les derniers articles publiés sur le site"),
|
||||
'render_template' => 'template-blocks/generics/latest-post-query.php',
|
||||
'category' => 'client-blocks',
|
||||
'multiple' => false,
|
||||
'mode' => 'auto',
|
||||
'align' => 'wide',
|
||||
'icon' => 'schedule',
|
||||
// 'enqueue_style' => get_template_directory_uri() . '/template-parts/blocks/testimonial/testimonial.css',
|
||||
// 'enqueue_script' => get_template_directory_uri() . '/template-parts/blocks/testimonial/testimonial.js',
|
||||
// 'enqueue_assets' => function(){
|
||||
// wp_enqueue_script( 'latest_articles_js', get_stylesheet_directory_uri() . '/template-parts/blocks/home/latest_articles/latest_articles.js');
|
||||
// },
|
||||
|
||||
));
|
||||
}
|
||||
// ACF
|
||||
register_block_type(get_template_directory() . '/blocks/acf/home/home-header');
|
||||
}
|
||||
add_action('acf/init', 'acf_custom_client_blocks_init');
|
||||
|
||||
|
||||
function mywp_register_acf_blocks()
|
||||
{
|
||||
// Check availability of block editor
|
||||
if (!function_exists('register_block_type')) {
|
||||
return;
|
||||
}
|
||||
register_block_type(get_template_directory() . '/template-blocks/home/home-header');
|
||||
}
|
||||
add_action('init', 'mywp_register_acf_blocks');
|
||||
add_action('init', 'lhoist_content_blocks_init');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ##### Blocks style 🡒 Re-enqueue d'un style dans l'éditeur
|
||||
|
||||
|
||||
// function block_newsfeed_add_editor_styles() {
|
||||
// add_editor_style( get_stylesheet_directory_uri() . '/template-parts/blocks/editor.css' );
|
||||
// }
|
||||
// add_action( 'admin_init', 'block_newsfeed_add_editor_styles' );
|
||||
// require_once(get_template_directory() . '/blocks/todo-list/todo-list.php');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user