homegrade_blocks_production/build/chapter-header/render.php

31 lines
1.2 KiB
PHP

<?php
// $attributes = get_block_attributes();
// echo '<pre>';
// print_r($block);
// echo '</pre>';
$thematique = get_the_terms(get_the_ID(), 'thematiques')[0];
$thematique_generale = $thematique->parent ? get_term($thematique->parent, 'thematiques') : $thematique;
$thematique_picture = get_field('taxonomy_pictures', "thematiques_" . $thematique_generale->term_id)['illustration_s'];
echo '<pre>';
// print_r(getThematiqueFamilySlug($thematique->slug));
// print_r(getThematiqueFamilySlug("acoustique"));
// print_r("salut");
// print_r($thematique);
// print_r($thematique_generale);
// print_r($thematique_picture);
echo '</pre>';
?>
<section class="chapter-header-block <?php echo "bg-" . getThematiqueFamilySlug($thematique_generale->slug) . "-light" ?>">
<div class="chapter-header-block__infos">
<p class="chapter-header-block__page-thematic-title <?php echo "text-" . getThematiqueFamilySlug($thematique_generale->slug) ?>"><?php echo $thematique_generale->name ?></p>
<h1 class="chapter-header-block__page-title"><?php echo get_the_title() ?></h1>
<a href="">Télécharger la brochure</a>
</div>
<img class="chapter-header-block__page-thematic-cover " src="<?php echo $thematique_picture['url'] ?>" alt="">
</section>