homegrade_blocks_production/blocks/questions-container-auto/build/render.php

36 lines
951 B
PHP

<?php
$relatedPostId = $attributes['relatedPostId'] ?? null;
$relatedPost = get_post($relatedPostId);
$term = get_the_terms(get_the_ID(), 'thematiques')[0];
$args = array(
'post_per_page' => 30,
'post_status' => 'publish',
'post_type' => 'questions',
'thematiques' => $term->ID,
'lang' => ICL_LANGUAGE_CODE,
);
$relatedPosts = new WP_Query($args);
?>
<section class="questions-container-block">
<?php if ($relatedPosts->have_posts()) : ?>
<?php while ($relatedPosts->have_posts()) :
$relatedPosts->the_post();
$thematique = get_the_terms(get_the_ID(), 'thematiques')[0];
$thematiqueParent = getParentThematique($thematique);
$thematiqueColorSlug = getThematiqueFamilySlug($thematiqueParent->slug);
?>
<article class="homegrade-blocks__texte-fonctionnel">
<h2><?php the_title() ?></h2>
<div><?php the_content() ?></div>
</article>
<?php endwhile; ?>
<?php endif; ?>
</section>
<?php wp_reset_postdata(); ?>