encapsulating suggested-publications section

This commit is contained in:
Antoine M 2023-12-13 17:35:29 +01:00
parent cd0d7d4730
commit 1138844470

View File

@ -48,43 +48,46 @@ get_header();
)); ?>
<!-- PUBLCIATIONS SUGGÉRÉS -->
<div class="card-large-content-container">
<?php
$args = array(
'post_type' => 'brochures',
'posts_per_page' => 5,
'orderby' => 'rand',
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => 'brochure_pdf',
'compare' => 'EXISTS'
)
),
);
$suggestedPublications = new WP_Query($args);
$pagePublicationsUrl = get_page_by_template('template-publications.php') ? get_permalink(get_page_by_template('template-publications.php')[0]->ID) : null;
?>
<div class="card-large-content">
<div class="section_titling">
<h2 class="section_titling__title"><?php echo __("Publications suggérées", "homegrade-theme__texte-fonctionnel") ?></h2>
<p class="section_titling__subtitle"><?php echo __("Consultez notre documentation pour en savoir plus", "homegrade-theme__texte-fonctionnel") ?></p>
</div>
<ul id="brochures-rows" class="publications-grid">
<?php
get_template_part(
'template-components/archives/brochure-rows',
null,
<section class="suggested-publications">
<!-- PUBLCIATIONS SUGGÉRÉS -->
<div class="card-large-content-container">
<?php
$args = array(
'post_type' => 'brochures',
'posts_per_page' => 5,
'orderby' => 'rand',
'post_status' => 'publish',
'meta_query' => array(
array(
'brochuresPosts' => $suggestedPublications,
'key' => 'brochure_pdf',
'compare' => 'EXISTS'
)
)
?>
</ul>
<a class="cta cta--outline cta--button mx-auto" href="<?php echo $pagePublicationsUrl ?>"><?php echo __("Consulter toutes les publications", "homegrade-theme__texte-fonctionel") ?></a>
),
);
$suggestedPublications = new WP_Query($args);
$pagePublicationsUrl = get_page_by_template('template-publications.php') ? get_permalink(get_page_by_template('template-publications.php')[0]->ID) : null;
?>
<div class="card-large-content">
<div class="section_titling">
<h2 class="section_titling__title"><?php echo __("Publications suggérées", "homegrade-theme__texte-fonctionnel") ?></h2>
<p class="section_titling__subtitle"><?php echo __("Consultez notre documentation pour en savoir plus", "homegrade-theme__texte-fonctionnel") ?></p>
</div>
<ul id="brochures-rows" class="publications-grid">
<?php
get_template_part(
'template-components/archives/brochure-rows',
null,
array(
'brochuresPosts' => $suggestedPublications,
)
)
?>
</ul>
<a class="cta cta--outline cta--button mx-auto" href="<?php echo $pagePublicationsUrl ?>"><?php echo __("Consulter toutes les publications", "homegrade-theme__texte-fonctionel") ?></a>
</div>
</div>
</div>
</section>
</div>
<?php endwhile; ?>
<?php endif; ?>