Metiers_du_patrimoine_theme/single-artisans.php

234 lines
7.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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/pictogrammes/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();