75 lines
2.2 KiB
PHP
Executable File
75 lines
2.2 KiB
PHP
Executable File
<?php
|
|
|
|
|
|
// ##### Blocks Category 🡒 Déclaration de la catégorie de blocks custom
|
|
function client_add_block_categories($categories)
|
|
{
|
|
return array_merge(
|
|
|
|
// [
|
|
// [
|
|
// 'slug' => 'homegrade-blocks',
|
|
// 'title' => 'Homegrade Generic Blocks ',
|
|
// 'icon' => 'heart',
|
|
// ],
|
|
// ],
|
|
$categories,
|
|
[
|
|
[
|
|
'slug' => 'homegrade-pages',
|
|
'title' => 'Homegrade Specific Page Blocks ',
|
|
'icon' => 'admin-page',
|
|
],
|
|
[
|
|
'slug' => 'homegrade-page-home',
|
|
'title' => 'Homegrade Blocks | Page d\'accueil',
|
|
'icon' => 'admin-page',
|
|
],
|
|
],
|
|
);
|
|
}
|
|
add_action('block_categories_all', 'client_add_block_categories', 10, 2);
|
|
|
|
|
|
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');
|
|
register_block_type(get_template_directory() . '/template-blocks/home/latest-news');
|
|
register_block_type(get_template_directory() . '/template-blocks/home/show-thematiques');
|
|
register_block_type(get_template_directory() . '/template-blocks/home/aides-financieres');
|
|
register_block_type(get_template_directory() . '/template-blocks/home/demarches-administratives');
|
|
register_block_type(get_template_directory() . '/template-blocks/home/questions-frequentes');
|
|
}
|
|
add_action('init', 'mywp_register_acf_blocks');
|
|
|
|
|
|
function my_register_blocks_scripts()
|
|
{
|
|
$theme = wp_get_theme();
|
|
wp_register_script('swiperjs', get_template_directory_uri() . '/assets/swiper/swiper-bundle.min.js', array('tailpress'), $theme->get('Version'), true);
|
|
wp_register_script('testjs', get_template_directory_uri() . '/template-blocks/home/show-thematiques/test.js', array('tailpress'), $theme->get('Version'), true);
|
|
}
|
|
|
|
|
|
|
|
|
|
add_action('init', 'my_register_blocks_scripts');
|
|
add_action('wp_enqueue_scripts', 'my_register_blocks_scripts');
|
|
add_action('enqueue_block_editor_assets', 'my_register_blocks_scripts');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ##### 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' );
|