updating component
This commit is contained in:
parent
05a4178ae0
commit
c77df3880d
96
single-questions.php
Normal file
96
single-questions.php
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
get_header();
|
||||
?>
|
||||
|
||||
|
||||
<?php if (have_posts()) : ?>
|
||||
<?php
|
||||
while (have_posts()) :
|
||||
the_post();
|
||||
$currentThematique = get_the_terms(get_the_ID(), 'thematiques')[0];
|
||||
$mainThematique = getMainThematique($currentThematique);
|
||||
$thematiqueColorSlug = $mainThematique->slug;
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'conseils',
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'thematiques',
|
||||
'field' => 'slug',
|
||||
'terms' => $mainThematique->slug,
|
||||
)
|
||||
)
|
||||
);
|
||||
$relatedConseils = new WP_Query($args);
|
||||
$relatedConseilsUrl = get_permalink($relatedConseils->posts[0]->ID) ?? null;
|
||||
|
||||
?>
|
||||
<div class="post-question-page-container <?php echo $thematiqueColorSlug ? "post-question-page--" . $thematiqueColorSlug : "" ?>">
|
||||
|
||||
<?php get_template_part('template-components/post-questions/chapter-header', null, array(
|
||||
'postID' => get_the_ID(),
|
||||
)); ?>
|
||||
|
||||
<article class="container my-8 mx-auto entry-content single-editor-content <?php echo $thematiqueColorSlug ? "entry-content--" . $thematiqueColorSlug : "" ?>">
|
||||
|
||||
|
||||
<?php the_content() ?>
|
||||
</article>
|
||||
|
||||
<?php
|
||||
|
||||
?>
|
||||
|
||||
<?php get_template_part('template-components/post-conseils/chapter-header', null, array(
|
||||
'postID' => get_the_ID(),
|
||||
'title' => __("Retrouvez nos conseils sur l'isolation dans notre brochure écrite par des experts", "homegrade-theme__texte-fonctionnel"),
|
||||
'hasInfoCapsule' => false,
|
||||
'ctaUrl' => $relatedConseilsUrl,
|
||||
'ctaTitle' => __("Consulter nos conseils sur ", "homegrade-theme__texte-fonctionnel") . $mainThematique->name,
|
||||
'ctaTarget' => "_self",
|
||||
|
||||
)); ?>
|
||||
|
||||
<!-- 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',
|
||||
);
|
||||
$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>
|
||||
|
||||
|
||||
<?php endwhile; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php
|
||||
get_footer();
|
||||
47
template-components/post-questions/chapter-header.php
Normal file
47
template-components/post-questions/chapter-header.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
|
||||
$thematique = get_the_terms($args['postID'], 'thematiques')[0] ?? null;
|
||||
$thematique_generale = $thematique->parent ? get_term($thematique->parent, 'thematiques') : $thematique;
|
||||
$thematique_generale_id_fr =
|
||||
apply_filters('wpml_object_id', $thematique_generale->term_id, 'thematiques', TRUE, 'fr');
|
||||
|
||||
|
||||
// Récupère la source de l'image par rapport à l'ID FR pour s'assurer de bien synchroniser les images dans les deux langues
|
||||
$thematique_picture = get_field('taxonomy_pictures', "thematiques_" . $thematique_generale_id_fr)['illustration_s'] ?? null;
|
||||
$lastUpdate = get_the_modified_date('', $args['postID']);
|
||||
|
||||
$queryArgs = array(
|
||||
// 'fields' => 'ids',
|
||||
'post_type' => 'brochures',
|
||||
'posts_per_page' => 1,
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'thematiques',
|
||||
'field' => 'term_id',
|
||||
'terms' => $thematique->term_id
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<section class="post-question-chapter-header">
|
||||
<div class="post-question-chapter-header__infos">
|
||||
<p class="post-question-chapter-header__page-thematic-title"><?php echo $thematique_generale->name ?></p>
|
||||
|
||||
|
||||
<h1 class="post-question-chapter-header__page-title"><?php echo get_the_title($args['postID']) ?></h1>
|
||||
|
||||
|
||||
<?php
|
||||
get_template_part('template-components/post-infos-capsule', null, array(
|
||||
"postID" => $args['postID'],
|
||||
"modified" => $lastUpdate
|
||||
));
|
||||
?>
|
||||
|
||||
</div>
|
||||
<img class="post-question-chapter-header__page-thematic-cover " src="<?php echo $thematique_picture['url'] ?>" alt="">
|
||||
</section>
|
||||
Loading…
Reference in New Issue
Block a user