introducing sitemap block

This commit is contained in:
Antoine M 2023-12-12 12:02:11 +01:00
parent 327fed5cf4
commit 6eb5a01ae6
3 changed files with 82 additions and 2 deletions

View File

@ -0,0 +1,21 @@
{
"name": "acf/sitemap",
"title": "Plan du site",
"category": "homegrade-blocks",
"multiple": false,
"icon": {
"foreground": "#DF1E1E",
"src": "<svg xmlns=\"http: //www.w3.org/2000/svg\" viewBox=\"0 0 85.75 79.19\"><g id=\"Calque_1-2\" ><path d=\"m74.65,56.98c-.09,0-.18.03-.27.03-.82-2.17-1.83-4.25-3.07-6.08-2.83-4.19-7.79-7.41-12.62-10.35l-2.41-1.44c-3.71-2.2-6.92-4.1-9.41-6.94-1.55-1.76-2.07-4.84-2.2-7.2v-1.12c.02-.82,0-1.41,0-1.61v-.24c5.25-.88,9.27-5.42,9.27-10.92,0-6.13-4.97-11.11-11.11-11.11s-11.1,4.97-11.1,11.1c0,5.53,4.06,10.08,9.35,10.93v.27c-.01.18-.04.63-.04,1.38,0,.23,0,.51.02.78-.12,2.32-.57,5.09-1.57,6.31-2.51,3.07-6.62,5.53-10.59,7.91l-1.82,1.1c-4.84,2.94-9.79,6.16-12.62,10.35-1.38,2.04-2.45,4.4-3.3,6.84-.01,0-.02,0-.04,0-6.13,0-11.11,4.97-11.11,11.1s4.97,11.1,11.11,11.1,11.1-4.97,11.1-11.1c0-4.87-3.16-8.97-7.53-10.46.73-1.97,1.64-3.85,2.73-5.47,2.43-3.59,7.02-6.56,11.51-9.3l1.8-1.09c3.72-2.23,7.5-4.57,10.35-7.51v21.74c-5.27.87-9.3,5.41-9.3,10.92,0,6.13,4.97,11.11,11.1,11.11s11.11-4.97,11.11-11.11c0-5.52-4.04-10.07-9.32-10.92v-20.94c2.79,2.97,6.18,5.03,9.78,7.16l2.37,1.42c4.49,2.73,9.09,5.7,11.51,9.3.97,1.43,1.78,3.06,2.46,4.77-4.23,1.57-7.25,5.61-7.25,10.38,0,6.13,4.97,11.1,11.1,11.1s11.11-4.97,11.11-11.1-4.97-11.11-11.11-11.11Z\"/></g></svg>"
},
"supports": {},
"keywords": [
"Plan",
"site",
"sitemap",
"map"
],
"acf": {
"mode": "auto",
"renderTemplate": "sitemap.php"
}
}

View File

@ -0,0 +1,58 @@
<?php
$args = array(
'post_type' => 'page',
'post_parent' => 0,
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => -1,
'post_status' => 'publish'
);
$websitePages = new WP_query($args);
?>
<div <?php echo get_block_wrapper_attributes(['class' => 'homegrade-blocks-sitemap']); ?>>
<section class="homegrade-blocks-sitemap__primary-menu">
<h2><?php echo __("Menu principal", "homegrade-theme__texte-fonctionnel") ?></h2>
<?php
wp_nav_menu(
array(
'container' => 'false',
'theme_location' => 'homegrade',
'li_class' => 'menu-navlink',
'fallback_cb' => false,
'menu_class' => 'menu-homegrade--sitemap',
)
);
?>
</section>
<section class="homegrade-blocks-sitemap__secondary-menu">
<h2><?php echo __("Menu bandeau secondaire", "homegrade-theme__texte-fonctionnel") ?></h2>
<?php
wp_nav_menu(
array(
'container' => 'false',
'theme_location' => 'renovateur',
'li_class' => 'menu-navlink',
'fallback_cb' => false,
'menu_class' => 'menu-homegrade--sitemap',
)
);
?>
</section>
</div>

View File

@ -81,7 +81,8 @@ function create_block_multiblocks_block_init()
register_block_type(__DIR__ . '/blocks/monoblock/build'); // — ALLOWED IN GREYBOX / WHITE BOX
// ACF
register_block_type(__DIR__ . '/blocks/google-map');
register_block_type(__DIR__ . '/acf-blocks/google-map');
register_block_type(__DIR__ . '/acf-blocks/sitemap');
}
add_action('init', 'create_block_multiblocks_block_init');
@ -263,4 +264,4 @@ function wpdocs_load_textdomain()
require_once(__DIR__ . '/blocks/google-map/map-api-key.php');
require_once(__DIR__ . '/acf-blocks/google-map/map-api-key.php');