Compare commits

...

48 Commits

Author SHA1 Message Date
833482c9ad fixing backend styles
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-30 10:35:59 +01:00
e01117bfef introducing the editor style file 2024-10-30 10:34:43 +01:00
03df6bb0a4 starting to correct the color scheme 2024-10-30 10:34:28 +01:00
3d53b64a59 correcting cards height 2024-10-30 10:34:17 +01:00
32109ad7fc removing unecessary lineskips 2024-10-30 10:33:59 +01:00
af25eef0fc removing unecessary lineskips 2024-10-30 10:33:20 +01:00
facd04b16c starting to correct the color scheme 2024-10-30 10:32:57 +01:00
8d1de7b171 removing unecessary write log 2024-10-28 10:15:22 +01:00
06bf350c82 handling the photo grid 2024-10-28 10:14:45 +01:00
73b8b807b3 handling the photo grid 2024-10-28 10:14:15 +01:00
7176e8660a introducing the component 2024-10-28 10:08:18 +01:00
1abe6ca42f hadnlign thumbnail differently 2024-10-24 10:41:09 +02:00
3d1d85834e renaming the component 2024-10-24 10:40:50 +02:00
b30d8e42ab introducing the component 2024-10-24 10:40:43 +02:00
139c6d30a3 developping the page 2024-10-24 10:40:31 +02:00
213939a223 introducing the component 2024-10-24 10:40:18 +02:00
14d66ebb46 introducing the component 2024-10-24 10:40:10 +02:00
0531104dac introducing the component 2024-10-24 10:40:05 +02:00
cb58cf2232 updating with tags and taxonomies styles 2024-10-24 10:39:56 +02:00
d0ddf2c545 developping the single 2024-10-24 10:39:33 +02:00
aefa66cb37 post type chantiers 2024-10-24 10:39:11 +02:00
df20f54690 introducing artisan-search card component 2024-10-24 10:38:51 +02:00
f028049418 introducing icons 2024-10-24 10:38:34 +02:00
b8db88994b removing cta--strech from permalinks 2024-10-23 10:37:40 +02:00
93a9e09633 styling the single 2024-10-23 10:37:04 +02:00
f6a864e002 introducing single & heading box 2024-10-23 10:36:54 +02:00
af0d187d4c updating page structure 2024-10-23 10:36:37 +02:00
e8e1e0a330 introducing the single 2024-10-23 10:36:27 +02:00
d3d7611332 adapting component 2024-10-23 10:36:17 +02:00
82f106de2b removing unecessary write_log 2024-10-21 17:02:35 +02:00
f07d6cc3df first page proto sytling 2024-10-21 16:59:30 +02:00
a60b8b838a replicating shadows 2024-10-21 16:59:18 +02:00
28adcefb9b tests to fix url problems 2024-10-21 16:59:09 +02:00
0d212aec72 handling admin styles 2024-10-21 16:58:53 +02:00
f3366bd25b enqueuing theme style 2024-10-21 16:58:44 +02:00
43410a9337 handlingpost-type rename 2024-10-21 16:58:27 +02:00
332a7eb30a first functionnal repertoire page 2024-10-21 16:58:16 +02:00
47764e95f8 cleaning 2024-10-21 16:57:54 +02:00
0e0f7f2ba7 introducing dynamicSearch js 2024-10-21 16:57:12 +02:00
6c4e41c9f5 refactoring dynamic search 2024-10-21 16:57:00 +02:00
f50507b094 handling cta--read-more 2024-10-21 16:56:49 +02:00
7940bf2d8f buidling the taxos 2024-10-21 16:56:39 +02:00
d34fee3701 introducing the card 2024-10-21 16:56:30 +02:00
153971ea26 including graphic assets 2024-10-21 16:56:19 +02:00
097b66abb9 including shadows, cta, repertour and artisans-cards 2024-10-21 16:56:10 +02:00
fa5143c477 including admin, taxo, and api 2024-10-21 16:55:43 +02:00
80c632aebe setting up the api for artisans cards 2024-10-21 16:55:31 +02:00
9708903e42 updating with new envs 2024-10-21 16:55:18 +02:00
38 changed files with 1685 additions and 21 deletions

2
.gitignore vendored
View File

@ -11,4 +11,6 @@ init_script.sh
.env-sample .env-sample
.env-dev .env-dev
.env-prod .env-prod
.env_dev
.env_prod
Makefile Makefile

View File

@ -1,8 +1,4 @@
<?php get_header(); ?> <?php get_header(); ?>
<?php
?>
<div class="homegrade-page-container homegrade-page-container--metiers-patrimoine"> <div class="homegrade-page-container homegrade-page-container--metiers-patrimoine">

View File

@ -4,3 +4,6 @@
require_once(__DIR__ . '/includes/init.php'); require_once(__DIR__ . '/includes/init.php');
require_once(__DIR__ . '/includes/post_types.php'); require_once(__DIR__ . '/includes/post_types.php');
require_once(__DIR__ . '/includes/admin.php');
require_once(__DIR__ . '/includes/taxonomy.php');
require_once(__DIR__ . '/includes/api.php');

14
includes/admin.php Normal file
View File

@ -0,0 +1,14 @@
<?php
/* ---------------------------
ADMIN STYLES
---------------------------*/
// Amin Stylesheet
function metiers_du_patrimoine_custom_admin_stylesheet()
{
wp_enqueue_style('admin_styles', get_stylesheet_directory_uri() . '/css/admin-style.css');
}
add_action('admin_head', 'metiers_du_patrimoine_custom_admin_stylesheet');

99
includes/api.php Normal file
View File

@ -0,0 +1,99 @@
<?php
add_action('rest_api_init', function () {
/* ----------------
BUILDING ROUTES
-----------------*/
// ################ BUILD ARTISANS SEARCH RESULTS ################
// * BUILD MORE NEWS CARDS
register_rest_route('metiers-patrimoine-datas/v1/build', '/artisans', array(
'methods' => 'GET',
'callback' => 'build_search_artisan_posts_cards',
'permission_callback' => '__return_true',
));
});
// ################ ARTISANS ################
function build_search_artisan_posts_cards($request)
{
// write_log($request);
$currentLanguage = esc_html($request->get_param('current-page-language')) ?? 'fr';
$previousActivePage = esc_html($request->get_param('active-page')) ?? 1;
$postsPerPage = esc_html($request->get_param('posts-per-page')) ?? 12;
$taxonomy = esc_html($request->get_param('taxonomy')) ?? 'metiers';
$StringifiedTaxonomyIds = esc_html($request->get_param('taxonomy-ids')) ?? null;
$taxonomyIds = explode(',', $StringifiedTaxonomyIds);
$taxonomyIds = array_map('intval', $taxonomyIds);
$activePage = is_numeric($previousActivePage) ? $previousActivePage + 1 : 1;
$taxQuery = array(
array(
'taxonomy' => $taxonomy,
'terms' => $taxonomyIds,
'field' => 'term_id',
)
);
do_action('wpml_switch_language', $currentLanguage);
$args = array(
"status" => "publish",
"post_type" => "artisans",
"posts_per_page" => -1,
"paged" => $activePage,
"tax_query" => $taxQuery,
);
$newsPostsDatas = new WP_Query($args);
ob_start();
foreach ($newsPostsDatas->posts as $key => $post) {
$post_thumbnail = get_the_post_thumbnail($post->ID, 'full', array('class' => 'card-artisans__thumbnail')) ?? null;
$news_type = get_the_terms($post->ID, "news_type") ?? null;
$post_date = get_the_date('j.m.Y', $post->ID) ?? null;
get_template_part(
'template-components/artisans/card-artisans-search',
null,
array(
'card_variant' => 'activite',
'post_ID' => $post->ID,
'post_title' => get_the_title($post->ID),
'post_thumbnail' => $post_thumbnail,
'news_type' => $news_type,
'post_date' => $post_date,
'current_taxonomy' => $taxonomy,
)
);
}
$html_template = ob_get_clean();
$response_data = array(
'html_template' => $html_template,
'total_posts_found' => $newsPostsDatas->found_posts,
'active_page' => $activePage,
'max_num_pages' => $newsPostsDatas->max_num_pages,
);
$response = new WP_REST_Response($response_data);
$response->set_status(200);
return $response;
}

View File

@ -2,16 +2,42 @@
/* ----------------------------------------------------------- /* -----------------------------------------------------------
Enqueue Theme assets 🡒 Front Enqueue Theme assets 🡒 Front
-----------------------------------------------------------*/ -----------------------------------------------------------*/
// add_theme_support('block-template-parts');
// add_theme_support( 'block-templates' );
function metiers_patrimoine_enqueue_scripts() function metiers_patrimoine_enqueue_scripts()
{ {
$theme = wp_get_theme(); $theme = wp_get_theme();
wp_enqueue_style('metiers-theme-main-css', get_stylesheet_directory_uri() . '/css/app.css', array('homegrade-main-css'), $theme->get('Version')); wp_enqueue_style('metiers-theme-main-css', get_stylesheet_directory_uri() . '/css/app.css', array('homegrade-main-css'), $theme->get('Version'));
wp_enqueue_script('metiers-theme-main-js', get_stylesheet_directory_uri() . '/js/app.js', array(), $theme->get('Version'));
} }
add_action('wp_enqueue_scripts', 'metiers_patrimoine_enqueue_scripts'); add_action('wp_enqueue_scripts', 'metiers_patrimoine_enqueue_scripts');
/* -----------------------------------------------------------
Enqueue Theme assets 🡒 Back
-----------------------------------------------------------*/
add_editor_style('css/editor-style.css');
function metiers_patrimoine_enqueue_back_scripts()
{
$theme = wp_get_theme();
wp_enqueue_style('metiers-theme-main-css', get_stylesheet_directory_uri() . '/css/app.css', array('homegrade-main-css'), $theme->get('Version'));
wp_enqueue_script('metiers-theme-main-js', get_stylesheet_directory_uri() . '/js/app.js', array(), $theme->get('Version'));
}
add_action('wp_enqueue_scripts', 'metiers_patrimoine_enqueue_scripts');
add_action('enqueue_block_editor_assets', 'metiers_patrimoine_enqueue_back_scripts');
function wpacg_mtier_patrimoine_admin_color_scheme() function wpacg_mtier_patrimoine_admin_color_scheme()
{ {
//Get the theme directory //Get the theme directory
@ -26,3 +52,20 @@ function wpacg_mtier_patrimoine_admin_color_scheme()
); );
} }
add_action('admin_init', 'wpacg_mtier_patrimoine_admin_color_scheme'); add_action('admin_init', 'wpacg_mtier_patrimoine_admin_color_scheme');
// add_filter('block_editor_settings_all', function ($settings) {
// $settings['siteEditor'] = false;
// return $settings;
// });
// add_filter('use_block_editor_for_post', '__return_false', 10);
// add_action('admin_init', function () {
// global $pagenow;
// if ($pagenow == 'site-editor.php') {
// wp_redirect(admin_url('edit.php?post_type=page')); // Redirection vers l'éditeur classique des pages
// exit;
// }
// });

View File

@ -1,16 +1,12 @@
<?php <?php
// #### POST TYPES // #### POST TYPES
function metiers_patrimoine_create_posttype() function metiers_patrimoine_create_posttype()
{ {
// **** VOCABULAIRE // **** ARTISANS
register_post_type( register_post_type(
'artisans', 'artisans',
array( array(
@ -26,9 +22,46 @@ function metiers_patrimoine_create_posttype()
'menu_position' => 5.1, 'menu_position' => 5.1,
'supports' => array('title', 'custom-fields'), 'supports' => array('title', 'custom-fields', 'thumbnail'),
)
);
// **** VOCABULAIRE
register_post_type(
'chantiers',
array(
'labels' => array(
'name' => __('Chantiers', 'metiers-patrimoine-theme'),
'singular_name' => __('Chantier', 'metiers-patrimoine-theme')
),
'public' => true,
'has_archive' => true,
'show_in_rest' => true,
'menu_icon' => 'dashicons-hammer',
'menu_position' => 5.1,
'supports' => array('title', 'custom-fields', 'thumbnail', 'author', 'revisions'),
) )
); );
} }
add_action('init', 'metiers_patrimoine_create_posttype'); add_action('init', 'metiers_patrimoine_create_posttype');
function metiers_patrimoine_artisant_post_title_updater($post_id)
{
if (!$post_id) return;
$my_post = array();
$my_post['ID'] = $post_id;
$name = get_field("name", $post_id);
if (get_post_type() == 'artisans' && $name) {
$my_post['post_title'] = "";
$my_post['post_title'] = $name;
}
wp_update_post($my_post);
}
add_action('acf/save_post', 'metiers_patrimoine_artisant_post_title_updater', 20);

76
includes/taxonomy.php Normal file
View File

@ -0,0 +1,76 @@
<?php
/* -------------------
REGISTER TAXONOMIES
--------------------*/
function metiers_patrimoine_add_custom_taxonomies()
{
// ————— Thématiques —————
register_taxonomy('metiers', ['artisans'], array(
// 'hierarchical' => true,
'labels' => array(
'name' => __('Métiers', 'metiers-patrimoine-theme'),
'singular_name' => __('Métier', 'metiers-patrimoine-theme'),
'search_items' => __('Chercher un Métier', 'metiers-patrimoine-theme'),
'all_items' => __('Tous les métiers', 'metiers-patrimoine-theme'),
'parent_item' => __('Métier Parent', 'metiers-patrimoine-theme'),
'parent_item_colon' => __('Métier Parent:', 'metiers-patrimoine-theme'),
'edit_item' => __('Editer le Métier', 'metiers-patrimoine-theme'),
'update_item' => __('Mettre à jour le Métier', 'metiers-patrimoine-theme'),
'add_new_item' => __('Ajouter un Métier', 'metiers-patrimoine-theme'),
'new_item_name' => __('Nom du nouveau Métier', 'metiers-patrimoine-theme'),
'menu_name' => __('Métiers', 'metiers-patrimoine-theme'),
),
'public' => true,
'show_in_rest' => true, // Needed for tax to appear in Gutenberg editor
'show_ui' => true,
'show_admin_column' => false,
'show_in_quick_edit' => false,
'meta_box_cb' => false,
'hierarchical' => true,
'rewrite' => array(
'slug' => 'questions-thematiques',
// 'with_front' => false,
'hierarchical' => true,
'has_archive' => true
),
));
// ————— Thématiques —————
register_taxonomy('elementsbatiments', ['artisans'], array(
// 'hierarchical' => true,
'labels' => array(
'name' => __('Eléments du bâtiment ', 'metiers-patrimoine-theme'),
'singular_name' => __('Elément du bâtiment ', 'metiers-patrimoine-theme'),
'search_items' => __('Chercher un Élément', 'metiers-patrimoine-theme'),
'all_items' => __('Tous les Éléments', 'metiers-patrimoine-theme'),
'parent_item' => __('Élément Parent', 'metiers-patrimoine-theme'),
'parent_item_colon' => __('Élément Parent:', 'metiers-patrimoine-theme'),
'edit_item' => __('Editer l\'Élément', 'metiers-patrimoine-theme'),
'update_item' => __('Mettre à jour l\'Élément', 'metiers-patrimoine-theme'),
'add_new_item' => __('Ajouter un Élément', 'metiers-patrimoine-theme'),
'new_item_name' => __('Nom du nouveal Élément', 'metiers-patrimoine-theme'),
'menu_name' => __('Eléments du bâtiment', 'metiers-patrimoine-theme'),
),
'public' => true,
'show_in_rest' => true, // Needed for tax to appear in Gutenberg editor
'show_ui' => true,
'show_admin_column' => false,
'show_in_quick_edit' => false,
'meta_box_cb' => false,
'hierarchical' => true,
'rewrite' => array(
'slug' => 'questions-thematiques',
// 'with_front' => false,
'hierarchical' => true,
'has_archive' => true
),
));
}
add_action('init', 'metiers_patrimoine_add_custom_taxonomies', 0);

View File

@ -1,15 +1,117 @@
.homegrade-blocks-components-image__panel-body { .edit-post-visual-editor__post-title-wrapper {
.media-replace-container { h1 {
.components-dropdown .components-toolbar__control { font-weight: revert;
@apply !bg-patrimoine-sante-securite; font-size: revert;
color: white;
}
} }
} }
.homegrade-blocks-components-image__panel-body #menu-posts-conseils,
.media-replace-container #menu-posts,
.components-dropdown #menu-pages,
.components-toolbar__control { #menu-media {
@apply !bg-patrimoine-sante-securite; /* @apply !pt-1; */
border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
}
#menu-posts-vocabulaire,
#menu-posts-videos-webinaires,
#toplevel_page_theme-general-settings {
/* @apply !pb-1; */
}
#toplevel_page_gf_edit_forms {
/* @apply !pb-1; */
border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}
/* .wp-block-post-content,
.is-root-container {
background-color: red !imporatant;
}
.block-editor-block-list__block {
background-color: yellow !imporatant; */
/* } */
.homegrade-blocks-components-icon__panel-body {
.icon-preview {
max-width: 80px;
padding: 20px 0;
}
}
.homegrade-blocks-components-image__panel-body {
.components-tip {
margin: 10px 0;
}
.media-replace-container {
.components-dropdown .components-toolbar__control {
background-color: #e04d42;
color: white;
}
}
img {
display: block;
}
.components-dropdown {
display: block;
width: fit-content;
}
.media-replace-container {
padding: 10px 0;
display: flex;
gap: 10px;
align-items: center;
}
.components-toggle-group-control-option-base {
outline: transparent;
}
.components-toggle-group-control {
div[role='presentation'] {
background-color: #e04d42;
}
}
}
.components-toggle-group-control {
div[role='presentation'] {
background-color: #e04d42;
}
}
.editor-post-featured-image__action {
background-color: #e04d42;
color: white;
&:hover {
color: #e04d42;
background-color: white;
}
}
.block-editor-block-styles__variants
button.components-button.block-editor-block-styles__item.is-active,
.block-editor-block-styles__variants
button.components-button.block-editor-block-styles__item.is-active:hover {
background: var(
--wp-components-color-accent,
var(--wp-admin-theme-color, #3858e9)
);
}
.components-toggle-group-control-option-base {
div {
@apply py-1;
line-height: 1.3;
}
}
.acf_custom_title {
.acf-label {
@apply pb-3;
label {
@apply !text-patrimoine-sante-securite !text-sm !font-semibold;
}
}
}
.block-editor-link-control__search-item-top {
word-break: break-all;
} }

View File

@ -4,3 +4,23 @@
@import 'color-scheme.css'; @import 'color-scheme.css';
/* BASE */
@import './base/shadows.css';
@import './base/cta.css';
@import './base/tags.css';
/* EDITOR CONTENT */
@import './editor-content/color-scheme.css';
/* PAGES */
@import './pages/repertoire-metiers.css';
@import './pages/single-artisans.css';
/* Components */
@import './components/heading-box.css';
/* TEMPLATES */
@import '../../template-components/artisans/card-artisans.css';
@import '../../template-components/artisans/card-taxonomies.css';
@import '../../template-components/conseil-patrimoine-redirector.css';

View File

@ -0,0 +1,5 @@
.cta--read-more:hover {
&:hover {
@apply text-patrimoine-sante-securite;
}
}

View File

@ -0,0 +1,9 @@
.shadowed {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.shadowed-lg {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
.shadowed-bottom {
box-shadow: 0 11px 14px -11px rgba(0, 0, 0, 0.15);
}

View File

@ -0,0 +1,6 @@
.taxonomy-tags {
@apply flex flex-wrap gap-2 mt-4;
.taxonomy-tag {
@apply bg-patrimoine-sante-securite-light text-patrimoine-sante-securite rounded-lg text-sm px-3 py-1;
}
}

View File

@ -0,0 +1,9 @@
.metiers-patrimoine-page-container--repertoire-metiers,
.metiers-patrimoine-page-container--single-artisans {
.heading-box {
@apply !mt-8 pb-6;
&__description {
@apply text-3xl max-w-screen-xl font-bold;
}
}
}

View File

@ -0,0 +1,3 @@
.section_titling__title {
@apply !text-patrimoine-sante-securite;
}

View File

@ -0,0 +1,159 @@
@import '../../../Homegrade_Theme/resources/css/utilities/shadows.css';
@import '../../../Homegrade_Theme/resources/css/components/cta.css';
/* @import './utilities/shadows.css'; */
.temp_guidance_sentence {
@apply text-center text-secondary font-bold;
}
.homegrade-blocks-highlight:not(
:has(.homegrade-blocks-highlight__titling)
)
.homegrade-blocks-custom-heading:first-child {
@apply !mt-0;
}
.homegrade-blocks-highlight
.homegrade-blocks-custom-heading {
@apply !font-bold;
}
body {
@apply font-sans;
}
.wp-block {
@apply max-w-screen-xl;
}
.wp-block[data-align='wide'] {
@apply max-w-screen-xl;
}
.wp-block[data-align='full'] {
@apply max-w-full;
}
.wp-block.alignfull {
@apply max-w-full;
}
.acf-block-component {
/* @apply bg-red-500; */
}
.acf-block-fields {
@apply max-w-screen-md mx-auto;
}
.block-editor-default-block-appender
.block-editor-inserter {
button {
@apply !bg-secondary;
}
}
.components-dropdown .components-toolbar__control {
background-color: #e04d42;
color: white;
}
ul,
ol {
@apply mt-4 mb-8;
}
ol {
@apply list-decimal list-inside;
}
ul li {
padding: 0.15rem 0;
@apply relative pl-5;
}
ul li:before {
@apply absolute left-0;
content: '';
display: inline-block;
height: 8px;
width: 8px;
border-radius: 50%;
margin-right: 14px;
margin-top: 9px;
@apply bg-secondary;
}
h1 {
@apply text-2xl;
}
h2 {
@apply text-xl mt-16 mb-8;
}
h3 {
@apply font-bold text-2xl mt-16 mb-4;
}
h4 {
@apply font-bold text-xl mt-6 mb-3;
}
h5 {
@apply font-bold text-lg mt-6 mb-3;
}
p {
@apply my-3 p-0;
}
.block-content-page-header {
h2 {
@apply !text-4xl mt-0 mb-12;
}
}
.homegrade-content-blocks-grey-box {
/* max-width: 100% !important; */
}
.homegrade-blocks-highlight--warning {
.wp-block-button__link {
@apply !bg-secondary;
}
}
.homegrade-blocks-plus-loin {
ol li::marker {
@apply !text-white;
}
ul li:before {
@apply !bg-white;
}
}
.homegrade-blocks-box-monoblock,
.homegrade-blocks-tips-to-know__tip,
.homegrade-blocks-plus-loin,
.homegrade-blocks-timeline-step,
.homegrade-blocks-content-page-header {
ul {
list-style: none !important;
}
}
.wp-block-button:not(
.is-style-outline,
.homegrade-blocks-shortcuts .wp-block-button
),
.wp-block-button.is-style-fill {
.wp-block-button__link {
@apply cta cta--secondary cta--button;
}
}
.homegrade-blocks-shortcuts .wp-block-button {
}
/* .homegrade-blocks-highlight__content__innerblocks .block-editor-block-list__layout {
} */
.wp-block-list {
@apply list-none;
}
.acf-block-fields ul {
li:before {
@apply content-none;
}
}

View File

@ -0,0 +1,101 @@
.artisans-posts {
@apply flex gap-4 pt-8;
&__grid {
@apply flex flex-col lg:grid grid-cols-1 lg:grid-cols-2 gap-6 w-full h-fit;
}
.card-artisans {
/* @apply h-fit; */
}
}
.metier-patrimoine-searchbar {
@apply max-w-xs;
h4 {
@apply my-0;
}
.checkbox-choice {
@apply pl-0;
@apply flex flex-wrap;
ul {
@apply pl-4 my-1 w-full;
}
&:before {
content: none;
/* box-shadow: inset 1em 1em #8B2FF7; */
}
label,
input {
/* @apply inline; */
}
label {
@apply -translate-y-1 ml-2;
}
input[type='checkbox']:before {
box-shadow: inset 1em 1em #8b2ff7;
}
}
.fieldset-titling {
@apply flex items-center gap-4;
}
.fieldset-icon {
@apply w-10 h-10 p-2 bg-white rounded-lg shadowed;
object-fit: contain;
}
&__search-by {
@apply flex flex-col gap-4 mt-4;
legend {
@apply block text-neutral-400 uppercase !text-base tracking-wider mb-4;
}
.search-radio-card {
@apply bg-white rounded-lg p-4 shadowed flex justify-between;
label {
@apply font-bold;
}
label:before {
@apply mr-2 translate-y-2 bg-no-repeat;
background-position: center;
background-size: contain;
content: '';
display: inline-block;
height: 30px;
width: 36px;
}
label[for='building_elements']:before {
background-image: url('../resources/img/Homegrade_repertoire-elements.svg');
}
label[for='job_types']:before {
background-image: url('../resources/img/Homegrade_repertoire-metiers.svg');
}
}
}
&__elements-batiments-filters,
&__metiers-filters {
@apply border border-neutral-300 p-4 rounded-3xl my-4;
}
/* HIDE METIERS FILTERS WHEN SEARCH IS ON ELEMENTS BATIMENTS */
&:has(
.metier-patrimoine-searchbar__search-by
#elements_batiments_checkbox:checked
) {
.metier-patrimoine-searchbar__metiers-filters {
/* @apply hidden; */
@apply opacity-40;
}
}
/* HIDE ELEMENTS BATIMENTS FILTERS WHEN SEARCH IS ON METIERS */
&:has(
.metier-patrimoine-searchbar__search-by
#metiers_checkbox:checked
) {
.metier-patrimoine-searchbar__elements-batiments-filters {
/* @apply hidden; */
@apply opacity-40;
}
}
}

View File

@ -0,0 +1,92 @@
.metiers-patrimoine-page-container--single-artisans {
.heading-box {
@apply !mt-8 pb-6 mb-4;
&__description {
@apply text-3xl max-w-screen-xl font-bold;
}
}
.back-to-search {
@apply block w-fit !mb-2 p-2 font-bold;
&:before {
transition: margin 0.3s ease;
@apply content-[''] inline-flex h-3 w-3
bg-contain bg-center mr-3 bg-no-repeat;
background-image: url('../resources/img/Homegrade_back_icon.svg');
}
&:hover {
@apply !text-patrimoine-sante-securite;
&:before {
@apply mr-4;
}
}
}
.artisan_wrapper {
@apply flex gap-10;
}
aside {
@apply max-w-sm shrink-0;
}
.artisans-post {
&__section {
@apply !mb-12;
}
&__section-title {
@apply text-3xl font-bold !m-0 pb-3;
}
&__section--team {
.artisans-post__section-title {
@apply pb-8;
}
.artisan-member {
@apply flex gap-4 items-center;
&__icon {
@apply w-20 h-20 object-contain p-3 bg-white shadowed rounded-3xl;
}
&__name {
@apply text-xl font-bold !my-0 text-patrimoine-sante-securite;
}
&__description {
@apply pt-2;
}
}
}
&__section--chantiers {
.artisans-post__section-title {
@apply !pb-8;
}
.chantier {
&__infos {
@apply grid sm:grid-cols-2 items-center pt-4 pb-2;
}
&__city,
&__date {
@apply flex items-center gap-3 my-0;
&:before {
@apply content-[''] block h-8 w-8 bg-contain bg-center bg-no-repeat;
}
}
&__city:before {
background-image: url('../resources/img/Homegrade_repertoire-adresse.svg');
}
&__date:before {
background-image: url('../resources/img/Homegrade_repertoire-date-chantier.svg');
}
&__title {
@apply text-2xl font-bold !my-0 text-patrimoine-sante-securite;
}
&__description {
@apply pt-1;
}
&__photo-grid {
@apply grid md:grid-cols-2 gap-4;
img {
@apply w-full h-64 object-cover object-center rounded-lg;
}
}
}
}
}
}

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="6.235" height="9.001" viewBox="0 0 6.235 9.001">
<path id="Tracé_38214" data-name="Tracé 38214" d="M104.818,76.33l3.829-3.094-3.829-3.094" transform="translate(109.647 77.736) rotate(180)" fill="none" stroke="#8b2ff7" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
</svg>

After

Width:  |  Height:  |  Size: 342 B

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="repertoire-adresse" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 30.65 42.99">
<defs>
<style>
.cls-1 {
fill: url(#Dégradé_sans_nom_103);
}
.cls-2 {
fill: none;
stroke: #000;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 2px;
}
</style>
<linearGradient id="Dégradé_sans_nom_103" data-name="Dégradé sans nom 103" x1="-3464.4" y1="2599" x2="-3463.4" y2="2597.95" gradientTransform="translate(106191.91 98778.58) scale(30.65 -38.01)" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#8b2ff7"/>
<stop offset="1" stop-color="#eb79ff"/>
</linearGradient>
</defs>
<g id="Groupe">
<ellipse id="Ellipse_1658" class="cls-2" cx="15.09" cy="38.1" rx="8.67" ry="3.89"/>
<path id="Soustraction_30" class="cls-1" d="M15.32,38.01h0c-2.77-1.98-5.33-4.22-7.66-6.69-2.05-2.15-3.82-4.56-5.27-7.16C.9,21.53.07,18.58,0,15.55-.02,11.44,1.6,7.48,4.49,4.55c5.87-5.99,15.47-6.08,21.46-.22.07.07.15.14.22.22,2.89,2.93,4.5,6.89,4.49,11-.08,3.02-.9,5.98-2.4,8.6-1.44,2.6-3.21,5-5.27,7.16-2.33,2.48-4.89,4.72-7.66,6.69h0ZM15.32,10.36c-2.86-.04-5.21,2.25-5.25,5.11-.04,2.86,2.25,5.21,5.11,5.25,2.86.04,5.21-2.25,5.25-5.11,0-.02,0-.04,0-.06.02-2.84-2.27-5.17-5.11-5.19Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg id="repertoire-date-chantier" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 40.9 47.05"><defs><style>.cls-1{fill:url(#Dégradé_sans_nom_103);stroke-width:0px;}.cls-2{fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}</style><linearGradient id="Dégradé_sans_nom_103" x1="7.75" y1="16.78" x2="33.14" y2="42.17" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8b2ff7"/><stop offset="1" stop-color="#eb79ff"/></linearGradient></defs><rect class="cls-2" x="1" y="7.15" width="38.9" height="38.9" rx="6.62" ry="6.62"/><rect class="cls-1" x="6.33" y="18.2" width="28.23" height="22.55"/><line class="cls-2" x1="12.8" y1="12.99" x2="12.8" y2="1"/><line class="cls-2" x1="27.97" y1="12.99" x2="27.97" y2="1"/></svg>

After

Width:  |  Height:  |  Size: 843 B

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg id="repertoire-elements" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 44.14 42.99"><defs><style>.cls-1,.cls-2{stroke-width:0px;}.cls-1,.cls-3{fill:none;}.cls-2{fill:url(#Dégradé_sans_nom_103);}.cls-4{clip-path:url(#clippath);}.cls-3{stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}</style><clipPath id="clippath"><rect class="cls-1" x=".97" y=".97" width="35.99" height="41.04"/></clipPath><linearGradient id="Dégradé_sans_nom_103" x1="-3063.01" y1="2661.93" x2="-3061.41" y2="2660.25" gradientTransform="translate(26511.81 42744.12) scale(8.65 -16.06)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8b2ff7"/><stop offset="1" stop-color="#eb79ff"/></linearGradient></defs><g id="Groupe"><g id="Groupe_5255"><path id="Tracé_22671" class="cls-3" d="M1,18.46v23.53h35.94v-23.53L18.97,1,1,18.46Z"/><g id="Groupe_5254"><g class="cls-4"><g id="Groupe_5253"><path id="Tracé_22672" class="cls-3" d="M36.94,41.99H1v-23.54L18.97,1l17.97,17.46v23.54Z"/></g></g></g></g><rect id="Rectangle_1823" class="cls-2" x="25.38" y="5.29" width="18.76" height="20.06" rx="2" ry="2"/></g></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg id="repertoire-equipe" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 37.07 50.59"><defs><style>.cls-1{fill:url(#Dégradé_sans_nom_103);}.cls-1,.cls-2{stroke-width:0px;}.cls-3{fill:#fff;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}.cls-2{fill:url(#Dégradé_sans_nom_103-2);}</style><linearGradient id="Dégradé_sans_nom_103" x1="-2199.05" y1="2881.82" x2="-2198.05" y2="2880.77" gradientTransform="translate(5808.61 21465.88) scale(2.63 -7.44)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8b2ff7"/><stop offset="1" stop-color="#eb79ff"/></linearGradient><linearGradient id="Dégradé_sans_nom_103-2" x1="-2195" y1="2881.85" x2="-2194" y2="2880.8" gradientTransform="translate(5785.37 21460.39) scale(2.62 -7.44)" xlink:href="#Dégradé_sans_nom_103"/></defs><g id="Groupe"><g id="Groupe_3195"><g id="Groupe_de_masques_1"><g id="Groupe_5593"><g id="Groupe_5595"><g id="Groupe_5594"><path id="Tracé_23844" class="cls-3" d="M1,49.59c.34-1.09.82-2.53,1.49-4.18,0,0,.36-.88.77-1.79,1.62-3.6,5.34-9.45,5.6-9.85l18.98-6.94.29,7.22c2.01,1.44,3.72,3.25,5.03,5.34,1,1.61,1.76,3.35,2.25,5.18.42,1.65.64,3.34.66,5.03"/></g></g><g id="Groupe_5596"><path id="Tracé_23846" class="cls-3" d="M35.61,31.9l-14.99,8.65v-17.2l7.49-13.7,7.5,5.05v17.19Z"/><path id="Tracé_23847" class="cls-3" d="M20.62,40.55l-14.98-8.65V14.7l14.98,8.65v17.19Z"/><path id="Tracé_23848" class="cls-3" d="M5.64,14.7L13.13,1l14.98,8.65-7.49,13.7L5.64,14.7Z"/></g><path id="Tracé_23849" class="cls-1" d="M24.88,29.2l2.63-1.52v-5.92l-2.63,1.51v5.93Z"/><path id="Tracé_23850" class="cls-2" d="M29.86,26.35l2.62-1.51v-5.93l-2.62,1.51v5.93Z"/></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg id="repertoire-mail" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 57.01 37.69"><defs><style>.cls-1{fill:url(#Dégradé_sans_nom_103);stroke-width:0px;}.cls-2{fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}</style><linearGradient id="Dégradé_sans_nom_103" x1="11.42" y1="11.05" x2="56.95" y2="11.05" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8b2ff7"/><stop offset="1" stop-color="#eb79ff"/></linearGradient></defs><path class="cls-2" d="M56.01,5.47v26.77c0,2.46-1.84,4.45-4.11,4.45H16.48c-2.27,0-4.11-1.99-4.11-4.45V5.47"/><path class="cls-1" d="M51.9,0H16.48c-2.79,0-5.05,2.45-5.05,5.47,0,.34.16.66.42.85l21.82,15.61c.16.11.34.17.52.17s.36-.06.52-.17l21.82-15.61c.26-.19.42-.51.42-.85,0-3.02-2.27-5.47-5.05-5.47Z"/><line class="cls-2" x1="24.08" y1="20.24" x2="5.24" y2="20.24"/><line class="cls-2" x1="18" y1="29.01" x2="1" y2="29.01"/></svg>

After

Width:  |  Height:  |  Size: 989 B

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg id="repertoire-metiers" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 49.6 46.25"><defs><style>.cls-1{fill:url(#Dégradé_sans_nom_103);stroke-width:0px;}.cls-2{fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}</style><linearGradient id="Dégradé_sans_nom_103" x1="0" y1="36.18" x2="20.13" y2="36.18" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8b2ff7"/><stop offset="1" stop-color="#eb79ff"/></linearGradient></defs><rect class="cls-2" x="10.86" y="23.81" width="19.44" height="4.04" transform="translate(-12.24 22.12) rotate(-45)"/><path class="cls-2" d="M42.49,18.37l-.86.86c-.31.31-.82.31-1.13,0l-.93-.93c-.31-.31-.31-.82,0-1.13l.86-.86c.31-.31.31-.82,0-1.13l-10.94-10.94c-.43-.45-3.37-3.43-7.99-3.22-2.07.09-3.75.79-5.02,1.59-.67.43-.36,1.47.44,1.47,1.44,0,2.86.57,3.88,1.67,1.59,1.71,1.85,4.31.66,6.34-.19.32-.15.72.11.99l10.48,10.48c.31.31.82.31,1.13,0h0c.31-.31.82-.31,1.13,0l.93.93c.31.31.31.82,0,1.13l-.73.73c-.31.31-.31.82,0,1.13l4.75,4.75c.31.31.82.31,1.13,0l1.3-1.3,5.25-5.25,1.43-1.43c.31-.31.31-.82,0-1.13l-4.75-4.75c-.31-.31-.82-.31-1.13,0Z"/><path class="cls-1" d="M19.84,32.59l-6.19-6.19c-.38-.38-.99-.38-1.37,0L.28,38.41c-.18.18-.28.43-.28.69s.1.5.28.69l6.19,6.19c.19.19.44.28.69.28s.5-.09.69-.28l12-12c.18-.18.28-.43.28-.69s-.1-.5-.28-.69Z"/><line class="cls-2" x1="42.09" y1="18.77" x2="34.51" y2="26.34"/></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg id="repertoire-site" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 41.58 44.39"><defs><style>.cls-1{fill:url(#Dégradé_sans_nom_103);stroke-width:0px;}.cls-2{fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}</style><linearGradient id="Dégradé_sans_nom_103" x1="26.49" y1="106.06" x2="44.85" y2="106.06" gradientTransform="translate(-6.53 -71.56) rotate(-1.77)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8b2ff7"/><stop offset="1" stop-color="#eb79ff"/></linearGradient></defs><path id="Icon_awesome-mouse-pointer" class="cls-1" d="M40.95,34.35l-4.98,1.31,4.3,5.69c.3.39.23.94-.14,1.25l-2.04,1.61c-.38.29-.92.22-1.21-.16,0,0,0,0,0,0l-4.09-5.4-2.97,5.25c-.24.41-.77.54-1.18.3-.2-.12-.34-.31-.39-.53l-5.31-20.16c-.13-.46.14-.93.6-1.06.22-.06.46-.03.66.08l16.96,10.21c.42.25.56.8.31,1.22-.11.19-.3.33-.51.4Z"/><path class="cls-2" d="M22.41,37.63c-.57.15-1.59.39-2.87.46-7.26.36-14.76-5.2-17.35-12.02-.77-2.03-1.19-4.23-1.19-6.52,0-2.09.35-4.1.99-5.97C4.46,6.27,11.39,1,19.54,1c10.25,0,18.55,8.31,18.55,18.55,0,1.53-.25,3.07-.25,3.07-.23,1.39-.59,2.55-.93,3.45"/><path class="cls-2" d="M19.54,38.09c-2.61,0-4.84-5-5.7-12.02-.25-2.03-.39-4.23-.39-6.52,0-2.09.11-4.1.32-5.97.82-7.31,3.09-12.58,5.77-12.58s5.06,7.79,5.77,12.58c.37,2.54.36,4.68.27,6.15"/><line class="cls-2" x1="1.98" y1="13.58" x2="37.1" y2="13.58"/><path class="cls-2" d="M20.24,26.06c-2.13,0-4.27,0-6.4,0H2.19"/></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg id="repertoire-telephone" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 36.53 38.86"><defs><style>.cls-1{fill:url(#Dégradé_sans_nom_103);stroke-width:0px;}.cls-2{fill:none;stroke:#000;stroke-linecap:round;stroke-width:2px;}</style><linearGradient id="Dégradé_sans_nom_103" x1="-3676.44" y1="2660.91" x2="-3675.45" y2="2659.86" gradientTransform="translate(-88743.08 122669.43) rotate(90) scale(33.36 -33.36)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8b2ff7"/><stop offset="1" stop-color="#eb79ff"/></linearGradient></defs><path id="Icon_awesome-phone" class="cls-1" d="M31.76,37.65l1.56-6.78c.17-.74-.21-1.49-.91-1.79l-7.3-3.13c-.64-.27-1.38-.09-1.82.45l-3.23,3.95c-5.07-2.39-9.15-6.47-11.55-11.55l3.95-3.23c.54-.44.72-1.18.45-1.82l-3.13-7.3c-.3-.7-1.06-1.08-1.8-.91l-6.77,1.56C.5,7.26,0,7.9,0,8.62c0,16.7,13.53,30.23,30.22,30.24h.01c.73,0,1.36-.5,1.53-1.21Z"/><path id="Tracé_20945" class="cls-2" d="M19.18,8.09s7.49.44,9.25,9.25"/><path id="Tracé_20946" class="cls-2" d="M21.34,1s11.49.67,14.19,14.18"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,5 @@
import dynamicSearchInit from './dynamicSearch';
window.addEventListener('DOMContentLoaded', (event) => {
dynamicSearchInit();
});

View File

@ -0,0 +1,67 @@
function formatFormDataArray(formData) {
let formObjectDatas = {};
for (const [name, value] of formData) {
const cleanName = name.replace('[]', '');
if (formObjectDatas[cleanName]) {
// Si la clé correspond à un tableau (comme les checkboxes)
// ajouter la nouvelle valeur au tableau
if (Array.isArray(formObjectDatas[cleanName])) {
formObjectDatas[cleanName].push(value);
} else {
formObjectDatas[cleanName] = [
formObjectDatas[cleanName],
value,
];
}
} else {
formObjectDatas[cleanName] = value;
}
}
return formObjectDatas;
}
async function hydrateFields(formObjectDatas) {
const currentLanguage = document
.querySelector('body')
.getAttribute('current-language');
const taxonomy = formObjectDatas.search_by;
const taxonomyIds =
taxonomy === 'metiers'
? formObjectDatas.metiers
: formObjectDatas.elementsbatiments;
const response = await fetch(
`/wp-json/metiers-patrimoine-datas/v1/build/artisans?current-page-language=${currentLanguage}&taxonomy=${taxonomy}&taxonomy-ids=${taxonomyIds}`
);
const artisansDatas = await response.json();
console.log(artisansDatas);
const artisansGrid = document.querySelector(
'.artisans-posts__grid'
);
artisansGrid.innerHTML = artisansDatas.html_template;
// brochureRows.setAttribute(
// 'current-post-count',
// brochuresDatas.total_posts_found
// );
}
export default function dynamicSearch() {
const form = document.querySelector(
'.metier-patrimoine-searchform'
);
form.addEventListener('change', (e) => {
e.preventDefault();
const form = e.target.closest('form');
const formData = new FormData(form);
let formObjectDatas = formatFormDataArray(formData);
console.log(formObjectDatas);
hydrateFields(formObjectDatas);
});
}

233
single-artisans.php Normal file
View File

@ -0,0 +1,233 @@
<?php
get_header();
?>
<?php
get_header();
$pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<nav class=" breadcrumbs_navigation" aria-label="<?php echo __("Vous êtes ici", "homegrade-theme__texte-fonctionnel") ?>">
<?php
$currentPage = get_post(get_queried_object_id());
$networkHomeUrl = network_home_url();
$pages = get_pages(array(
'meta_key' => '_wp_page_template',
'meta_value' => 'template-repertoire-des-metiers.php'
));
//get page id with template Template Name: Repertoire des métiers
$frontPageUrl = get_home_url();
$frontPageTitle = get_the_title(get_option('page_on_front'));
$searchPageId = 43;
$searchPageTitle = get_the_title($searchPageId);
$searchPageUrl = get_post_permalink($searchPageId);
$pageIcon = get_field('page_icon', $searchPageId) ?? null;
?>
<ol>
<li>
<a href="<?php echo $networkHomeUrl ?>" title="<?php echo __("Accueil", "homegrade-theme__texte-fonctionnel") ?>">
<img src="<?php echo get_template_directory_uri() . "/resources/img/pictogrammes/icon_house_dark.svg" ?>" alt="">
</a>
</li>
<li><a href="<?php echo $frontPageUrl ?>"><?php echo $frontPageTitle ?></a></li>
<li><a href="<?php echo $searchPageUrl ?>"><?php echo $searchPageTitle ?></a></li>
<?php if ($currentPage) : ?>
<li><a href="<?php echo get_post_permalink($currentPage->ID) ?>" aria-current="location" aria-disabled="true"><?php echo $currentPage->post_title ?></a></li>
<?php endif; ?>
</ol>
</nav>
<div class="homegrade-page-container metiers-patrimoine-page-container--single-artisans">
<?php /* --------
HEADING BOX
---------------*/ ?>
<?php
get_template_part("template-components/heading-box", null, array(
"pageIcon" => $pageIcon,
"title" => $currentPage->post_title,
"description" => __("En savoir plus sur nos artisans du patrimoine", "metiers-patrimoine-theme"),
));
?>
<a class="back-to-search" href="<?php echo $searchPageUrl ?>"><?php echo __("Retourner aux résultats de recherche", "metiers-patrimoine-theme") ?></a>
<div class="artisan_wrapper">
<aside class="artisan_info">
<?php
global $post;
$post_title = $post->post_title;
get_template_part(
'template-components/artisans/card-artisans-single',
null,
array(
'post_ID' => $post->ID,
'post_title' => $post_title,
)
);
get_template_part(
'template-components/artisans/card-taxonomies',
null,
array(
'post_ID' => $post->ID,
'post_title' => $post_title,
)
);
?>
</aside>
<div class="artisans-post">
<section class="artisans-post__section artisans-post__section--description">
<h2 class="artisans-post__section-title"><?php echo __("Activités de lentreprise", "metiers-patrimoine-theme") ?></h2>
<?php
$company_description = get_field('company_description');
$company_members = get_field('company_members');
?>
<p><?php echo $company_description ?></p>
</section>
<section class="artisans-post__section artisans-post__section--team ">
<h2 class="artisans-post__section-title"><?php echo __("L'équipe", "metiers-patrimoine-theme") ?></h2>
<?php
$company_description = get_field('company_description');
$company_members = get_field('company_members');
?>
<?php foreach ($company_members as $member): ?>
<div class="artisan-member">
<img class="artisan-member__icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/Homegrade_repertoire-equipe.svg' ?>" alt="">
<h3 class="artisan-member__name"><?php echo $member['first_name'] . ' ' . $member['last_name'] ?></h3>
</div>
<p class="artisan-member__description"><?php echo $member['description'] ?></p>
<?php endforeach; ?>
</section>
<section class="artisans-post__section artisans-post__section--chantiers">
<h2 class="artisans-post__section-title"> <?php echo __(" Chantiers réalisés ", "metiers-patrimoine-theme") ?>
</h2>
<?php
$args = array(
'post_type' => 'chantiers',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'artisan',
'value' => $post->ID,
'compare' => 'LIKE'
)
)
);
$chantiers = new WP_Query($args);
?>
<?php if ($chantiers->posts): ?>
<?php foreach ($chantiers->posts as $chantier): ?>
<?php
$chantier_description = get_field('description', $chantier->ID);
$date = get_field('date', $chantier->ID);
$city = get_field('city', $chantier->ID);
$pictures = get_field('pictures', $chantier->ID);
?>
<div class="chantier">
<h4 class="chantier__title"><?php echo $chantier->post_title ?></h4>
<div class="chantier__infos">
<p class="chantier__city"><?php echo $city ?></p>
<time class="chantier__date"> <?php echo $date ?></time>
</div>
<p class="chantier__description"><?php echo $chantier_description ?></p>
<div class="chantier__photo-grid">
<?php
foreach ($pictures as $key => $picture) {
}
?>
<?php foreach ($pictures as $picture): ?>
<img src="<?php echo $picture['sizes']['large'] ?>" />
<?php endforeach; ?>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</section>
</div>
</div>
<?php
$prevPost = get_previous_post();
$nextPost = get_next_post();
// echo $prev_post->post_title;
write_log($nextPost);
echo '<pre>';
print_r($prevPost);
echo '</pre>';
?>
<?php if ($nextPost) : ?>
<a class="previous-next-questions__next" href="<?php echo get_the_permalink($nextPost->ID) ?>">
<div class="previous-next-questions__link-content">
<p class="question_type"><?php echo __("Entreprise suivante ", "homegrade-theme__texte-fonctionnel") ?></p>
<p class="question_title"><?php echo $nextPost->post_title ?></p>
</div>
<img class="thematique_icon" src="<?php echo $thematique_icon['url'] ?>" alt="">
</a>
<?php endif; ?>
<?php if ($previousPost) : ?>
<a class="previous-next-questions__previous" href="<?php echo get_the_permalink($previousPost->ID) ?>">
<img class="thematique_icon" src="<?php echo $thematique_icon['url'] ?>" alt="">
<div class="previous-next-questions__link-content">
<p class="question_type"><?php echo __("Entreprise précédente ", "homegrade-theme__texte-fonctionnel") ?></p>
<p class="question_title"><?php echo $previousPost->post_title ?></p>
</div>
</a>
<?php endif; ?>
<?php
get_template_part('template-components/conseil-patrimoine-redirector', null, array());
?>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php get_footer();

View File

@ -0,0 +1,63 @@
<?php
$postID = $args['post_ID'];
$post_thumbnail = get_the_post_thumbnail($postID, 'full', array('class' => 'card-artisans__thumbnail card-post__thumbnail')) ?? null;
$post_title = $args['post_title'];
$post_permalink = get_the_permalink($postID);
$company_members = get_field('company_members', $postID);
$currentTaxonomy = $args['current_taxonomy'];
$taxonomyTerms = $currentTaxonomy === "elementsbatiments" ? get_the_terms($postID, 'elementsbatiments') : get_the_terms($postID, 'metiers');
$phoneNumber = get_field('phone_number', $postID);
$formattedPhoneNumber = preg_replace('/^(\+\d{2})(\d{3})(\d{2})(\d{2})(\d{2})$/', '$1 $2 $3 $4 $5', $phoneNumber);
$email = get_field('email', $postID);
$website = get_field('website', $postID);
$adresse = get_field('adresse', $postID);
?>
<article class="card-artisans">
<?php echo $post_thumbnail ?>
<div class="card-artisans__inner">
<h2 class="card-artisans__title"><?php echo $post_title ?></h2>
<?php if ($company_members): ?>
<p class="card-artisans__team-members">
<?php foreach ($company_members as $key => $member) : ?>
<span><?php echo $member['first_name'] . ' ' . $member['last_name']; ?></span>
<?php endforeach; ?>
</p>
<?php endif; ?>
<?php if ($taxonomyTerms): ?>
<div class="card-artisans__taxonomy-tags">
<?php foreach ($taxonomyTerms as $key => $term) : ?>
<span class="taxonomy-tag"><?php echo $term->name; ?></span>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if ($adresse): ?>
<p class="card-artisans__adresse"><?php echo $adresse['post_code'] . " " . $adresse['city'] ?></p>
<?php endif; ?>
<?php if ($phoneNumber): ?>
<a class="card-artisans__phone" href="tel:<?php echo $phoneNumber ?>"><?php echo $formattedPhoneNumber ?></a>
<?php endif; ?>
<?php if ($email): ?>
<a class="card-artisans__email" href="mailto:<?php echo $email ?>"><?php echo $email ?></a>
<?php endif; ?>
<?php if ($website): ?>
<?php $clean_website = str_replace(array('http://', 'https://'), '', $website); ?>
<a class="card-artisans__website" href="<?php echo $website ?>"><?php echo $clean_website ?></a>
<?php endif; ?>
<a href=" <?php echo get_the_permalink($postID) ?>" class="cta cta--read-more cta--with-arrow-button ">
<span><?php echo __("En savoir plus", 'metiers-du-patirmoine-theme') ?></span>
<span class="sr-only"> &nbsp;<?php echo $post_title ?></span>
<img class="cta_arrow_button" src='<?php echo get_template_directory_uri() ?>/resources/img/graphic-assets/arrow-right-circle.svg' alt=''>
</a>
</article>

View File

@ -0,0 +1,49 @@
<?php
$postID = $args['post_ID'];
$post_thumbnail = get_the_post_thumbnail($postID, 'full', array('class' => 'card-artisans__thumbnail card-post__thumbnail')) ?? null;
$post_title = $args['post_title'];
$company_members = get_field('company_members', $postID);
$phoneNumber = get_field('phone_number', $postID);
$formattedPhoneNumber = preg_replace('/^(\+\d{2})(\d{3})(\d{2})(\d{2})(\d{2})$/', '$1 $2 $3 $4 $5', $phoneNumber);
$email = get_field('email', $postID);
$website = get_field('website', $postID);
$adresse = get_field('adresse', $postID);
?>
<article class="card-artisans">
<?php echo $post_thumbnail ?>
<div class="card-artisans__inner">
<h2 class="card-artisans__title"><?php echo $post_title ?></h2>
<?php if ($company_members): ?>
<p class="card-artisans__team-members">
<?php foreach ($company_members as $key => $member) : ?>
<span><?php echo $member['first_name'] . ' ' . $member['last_name']; ?></span>
<?php endforeach; ?>
</p>
<?php endif; ?>
<?php if ($adresse): ?>
<p class="card-artisans__adresse"><?php echo $adresse['post_code'] . " " . $adresse['city'] ?></p>
<?php endif; ?>
<?php if ($phoneNumber): ?>
<a class="card-artisans__phone" href="tel:<?php echo $phoneNumber ?>"><?php echo $formattedPhoneNumber ?></a>
<?php endif; ?>
<?php if ($email): ?>
<a class="card-artisans__email" href="mailto:<?php echo $email ?>"><?php echo $email ?></a>
<?php endif; ?>
<?php if ($website): ?>
<?php $clean_website = str_replace(array('http://', 'https://'), '', $website); ?>
<a class="card-artisans__website" href="<?php echo $website ?>"><?php echo $clean_website ?></a>
<?php endif; ?>
</article>

View File

@ -0,0 +1,58 @@
.card-artisans {
@apply bg-white rounded-lg shadowed;
&__thumbnail {
@apply w-full h-32 lg:h-48 object-cover rounded-t-xl;
}
&__inner {
@apply p-6;
}
&__title {
@apply !text-2xl font-bold text-patrimoine-sante-securite !my-0;
}
&__team-members {
@apply font-bold !my-0;
}
&__taxonomy-tags {
@apply flex flex-wrap gap-2 mt-4;
.taxonomy-tag {
@apply bg-patrimoine-sante-securite-light text-patrimoine-sante-securite rounded-lg text-sm px-3 py-1;
}
}
&__adresse {
@apply font-normal underline-offset-4 inline-flex !mt-6 w-full;
&:before {
@apply inline-flex mr-3 h-6 w-6 bg-center bg-contain bg-no-repeat;
content: '';
background-image: url('../resources/img/Homegrade_repertoire-adresse.svg');
}
}
&__phone {
@apply font-semibold underline-offset-4 inline-flex w-full;
&:before {
@apply inline-flex mr-3 h-6 w-6 bg-center bg-contain bg-no-repeat;
content: '';
background-image: url('../resources/img/Homegrade_repertoire-telephone.svg');
}
}
&__email {
@apply text-primary underline font-semibold underline-offset-4 inline-flex w-full;
&:before {
@apply inline-flex mr-3 h-6 w-6 bg-center bg-contain bg-no-repeat;
content: '';
background-image: url('../resources/img/Homegrade_repertoire-mail.svg');
}
}
&__website {
@apply text-primary underline font-semibold underline-offset-4 inline-flex w-full;
&:before {
@apply inline-flex mr-3 h-6 w-6 bg-center bg-contain bg-no-repeat;
content: '';
background-image: url('../resources/img/Homegrade_repertoire-site.svg');
}
}
.cta--read-more {
@apply mt-6;
}
}

View File

@ -0,0 +1,20 @@
.card-taxonomies {
@apply bg-white rounded-2xl p-8 border border-neutral-200 mt-6;
@apply flex flex-col gap-8 items-start;
&__titling {
@apply flex items-center gap-4;
.card-taxonomies__title {
@apply my-0;
}
.card-taxonomies__icon {
@apply w-10 h-10 p-2 bg-white rounded-lg shadowed;
object-fit: contain;
}
}
&__taxo-container {
@apply !m-0;
}
}

View File

@ -0,0 +1,45 @@
<?php
$postID = $args['post_ID'];
$post_title = $args['post_title'];
$post_permalink = get_the_permalink($postID);
$company_members = get_field('company_members', $postID);
$elementsBatimentsTerms = get_the_terms($postID, 'elementsbatiments');
$metiersTerms = get_the_terms($postID, 'metiers');
?>
<article class="card-taxonomies">
<?php if ($elementsBatimentsTerms): ?>
<div class="card-taxonomies__taxo-container card-taxonomies__taxo-elementsbatiments">
<div class="card-taxonomies__titling">
<img class="card-taxonomies__icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/Homegrade_repertoire-elements.svg' ?>" alt=''>
<h4 class="card-taxonomies__title"><?php echo __("Éléments du bâtiment", "metiers-patrimoine-theme") ?></h4>
</div>
<div class="taxonomy-tags card-taxonomies__taxonomy-tags">
<?php foreach ($elementsBatimentsTerms as $key => $term) : ?>
<span class="taxonomy-tag"><?php echo $term->name; ?></span>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<?php if ($metiersTerms): ?>
<div class="card-taxonomies__taxo-container card-taxonomies__taxo-metiers">
<div class="card-taxonomies__titling">
<img class="card-taxonomies__icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/Homegrade_repertoire-metiers.svg' ?>" alt=''>
<h4 class="card-taxonomies__title"><?php echo __("Métiers du partrimoine", "metiers-patrimoine-theme") ?></h4>
</div>
<div class="taxonomy-tags card-taxonomies__taxonomy-tags">
<?php foreach ($metiersTerms as $key => $term) : ?>
<span class="taxonomy-tag"><?php echo $term->name; ?></span>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</article>

View File

@ -0,0 +1,13 @@
.post-conseils-chapter-header {
@apply bg-patrimoine-sante-securite-light py-2;
&__page-thematic-title {
@apply !text-patrimoine-sante-securite;
}
&__page-title {
@apply !text-3xl font-bold !m-0 pb-3;
}
&__page-thematic-cover {
@apply max-h-80;
}
}

View File

@ -0,0 +1,43 @@
<?php
switch_to_blog(1);
$patrimoineTermId = 32;
$patrimoineTerm = get_term(32, 'thematiques');
$postConseilPatrimoine = get_posts(array(
'post_type' => 'conseils',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'thematiques',
'field' => 'id',
'terms' => $patrimoineTermId,
'include_children' => false,
)
)
));
// write_log($postConseilPatrimoine);
$postConseilPatrimoineUrl = get_permalink($postConseilPatrimoine[0]->ID);
$thematique_picture = get_field('taxonomy_pictures', "thematiques_" . $patrimoineTerm->term_id)['illustration_s'] ?? null;
restore_current_blog();
?>
<section class="post-conseils-chapter-header">
<div class="post-conseils-chapter-header__infos">
<p class="post-conseils-chapter-header__page-thematic-title"><?php echo $patrimoineTerm->name ?></p>
<h3 class="post-conseils-chapter-header__page-title"><?php echo __("Les conseillères et conseillers Homegrade vous guident", "metiers-patrimoine-theme") ?></h3>
<a class="cta cta--primary cta--button" href="<?php echo $postConseilPatrimoineUrl ?>">
<?php echo __("Parcourir nos conseils", "metiers-patrimoine-theme") ?></a>
</div>
<img class="post-conseils-chapter-header__page-thematic-cover " src="<?php echo $thematique_picture['url'] ?>" alt="">
</section>

View File

@ -0,0 +1,260 @@
<?php /* Template Name: Repertoire des métiers */ ?>
<?php
get_header();
$pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
?>
<div class="homegrade-page-container metiers-patrimoine-page-container--repertoire-metiers">
<nav class=" breadcrumbs_navigation" aria-label="<?php echo __("Vous êtes ici", "homegrade-theme__texte-fonctionnel") ?>">
<?php
$currentPage = get_post(get_queried_object_id());
$networkHomeUrl = network_home_url();
$frontPageUrl = get_home_url();
$frontPageTitle = get_the_title(get_option('page_on_front'));
?>
<ol>
<li>
<a href="<?php echo $networkHomeUrl ?>" title="<?php echo __("Accueil", "homegrade-theme__texte-fonctionnel") ?>">
<img src="<?php echo get_template_directory_uri() . "/resources/img/pictogrammes/icon_house_dark.svg" ?>" alt="">
</a>
</li>
<li><a href="<?php echo $frontPageUrl ?>"><?php echo $frontPageTitle ?></a></li>
<?php if ($currentPage) : ?>
<li><a href="<?php echo get_post_permalink($currentPage->ID) ?>" aria-current="location" aria-disabled="true"><?php echo $currentPage->post_title ?></a></li>
<?php endif; ?>
</ol>
</nav>
<?php /* --------
HEADING BOX
---------------*/ ?>
<?php
get_template_part("template-components/heading-box", null, array(
"pageIcon" => $pageIcon,
"title" => $currentPage->post_title,
"description" => __("Cherchez une entreprise ou un artisan", "metiers-patrimoine-theme"),
));
?>
<section class="artisans-posts">
<aside class="metier-patrimoine-searchbar">
<div class="metier-patrimoine-searchbar__results-indications">
<p class="metier-patrimoine-searchbar__posts-results-amount" role="status" aria-live="polite">
<span class="results-amount">
4 </span>
<span class="results-text">
résultat(s) </span>
</p>
</div>
<form class="metier-patrimoine-searchform" action="">
<input type="hidden" value="1" name="active-page">
<fieldset class="metier-patrimoine-searchbar__search-by">
<legend><?php echo __("Rechercher par", "metiers-patrimoine-theme") ?></legend>
<div class="search-radio-card">
<label for="building_elements"><?php echo __("Éléments du bâtiment", "metiers-patrimoine-theme") ?></label>
<input type="radio" id="elements_batiments_checkbox" name="search_by" value="elementsbatiments" checked />
</div>
<div class="search-radio-card">
<label for="job_types"><?php echo __("Métiers du patrimoine", "metiers-patrimoine-theme") ?></label>
<input type="radio" id="metiers_checkbox" name="search_by" value="metiers" />
</div>
</fieldset>
<fieldset class="metier-patrimoine-searchbar__elements-batiments-filters">
<div class="fieldset-titling">
<img class="fieldset-icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/Homegrade_repertoire-metiers.svg' ?>" alt=''>
<h4 class="filter-title">Éléments du bâtiment</h4>
</div>
<ul>
<?php
// Récupérer tous les termes de la taxonomie 'elementsbatiments' avec une hiérarchie
$ElementBatimentsTerms = get_terms([
'taxonomy' => 'elementsbatiments',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => false,
]);
if ($ElementBatimentsTerms) :
// Organiser les termes par parent (hiérarchie)
$terms_by_parent = [];
// Boucle pour organiser les termes en fonction de leurs parents
foreach ($ElementBatimentsTerms as $term) {
if ($term->parent == 0) {
// Si c'est un parent, on le place dans le tableau des parents
$terms_by_parent[$term->term_id] = [
'term' => $term,
'children' => [],
];
} else {
$terms_by_parent[$term->parent]['children'][] = $term;
}
}
// Vérifier que l'organisation est correcte
// write_log($terms_by_parent); // Permet de déboguer l'organisation des termes
// Afficher les termes parents et leurs enfants
foreach ($terms_by_parent as $parent_term_data) :
$parent_term = $parent_term_data['term'];
?>
<li class="checkbox-choice">
<input type="checkbox" name="elementsbatiments[]" value="<?php echo esc_attr($parent_term->term_id); ?>" data-term="<?php echo esc_attr($parent_term->slug); ?>">
<label>
<?php echo esc_html($parent_term->name); ?>
</label>
<?php if (!empty($parent_term_data['children'])) : ?>
<ul>
<?php foreach ($parent_term_data['children'] as $child_term) : ?>
<li class="checkbox-choice">
<label>
<input type="checkbox" name="elementsbatiments[]" value="<?php echo esc_attr($child_term->term_id); ?>" data-term="<?php echo esc_attr($child_term->slug); ?>">
<?php echo esc_html($child_term->name); ?>
</label>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach;
endif; ?>
</ul>
</fieldset>
<fieldset class="metier-patrimoine-searchbar__metiers-filters">
<div class="fieldset-titling">
<img class="fieldset-icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/Homegrade_repertoire-elements.svg' ?>" alt=''>
<h4 class="filter-title">Métiers</h4>
</div>
<ul>
<?php
// Récupérer tous les termes de la taxonomie 'metiers' avec une hiérarchie
$MertiersTerms = get_terms([
'taxonomy' => 'metiers',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => false,
'stat'
]);
if ($MertiersTerms) :
$terms_by_parent = [];
foreach ($MertiersTerms as $term) {
if ($term->parent == 0 && !isset($terms_by_parent[$term->term_id])) {
$terms_by_parent[$term->term_id] = [
'term' => $term,
'children' => [],
];
}
if ($term->parent == 0 && isset($terms_by_parent[$term->term_id])) {
$terms_by_parent[$term->term_id]['term'] = $term;
} else {
if (!isset($terms_by_parent[$term->parent])) {
$terms_by_parent[$term->parent] = [
'term' => null,
'children' => [],
];
}
$terms_by_parent[$term->parent]['children'][] = $term;
}
}
foreach ($terms_by_parent as $parent_term_data) :
$parent_term = $parent_term_data['term'];
?>
<li class="checkbox-choice">
<input type="checkbox" name="metiers[]" value="<?php echo esc_attr($parent_term->term_id); ?>" data-term="<?php echo esc_attr($parent_term->slug); ?>">
<label>
<?php echo esc_html($parent_term->name); ?>
</label>
<!-- Afficher les enfants sous forme de checkboxes -->
<?php if (!empty($parent_term_data['children'])) : ?>
<ul>
<?php foreach ($parent_term_data['children'] as $child_term) : ?>
<li class="checkbox-choice">
<input type="checkbox" name="metiers[]" value="<?php echo esc_attr($child_term->term_id); ?>" data-term="<?php echo esc_attr($child_term->slug); ?>">
<label>
<?php echo esc_html($child_term->name); ?>
</label>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach;
endif; ?>
</ul>
</fieldset>
<!-- <button type="submit">submit</button> -->
</form>
</aside>
<div class="artisans-posts__grid">
<?php
$initialPosts = new WP_Query([
"status" => "publish",
"post_type" => "artisans",
"posts_per_page" => -1,
"paged" => 1,
]);
foreach ($initialPosts->posts as $key => $artisanPost) {
$post_date = get_the_date('j.m.Y', $artisanPost->ID) ?? null;
get_template_part(
'template-components/artisans/card-artisans-search',
null,
array(
'card_variant' => 'activite',
'post_ID' => $artisanPost->ID,
'post_title' => get_the_title($artisanPost->ID),
'current_taxonomy' => "elementsbatiments",
'post_date' => $post_date,
)
);
}
?>
</div>
</section>
</div>
<?php get_footer();