homegrade_theme_production/template-publications.php

279 lines
10 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php /* Template Name: Publications | Archive */
get_header();
$current_page_id = get_queried_object_id();
$pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
$posts_per_page = 5;
// #### BROCHURES QUERY
$args = array(
'post_type' => 'brochures',
'posts_per_page' => $posts_per_page,
'post_status' => 'publish',
'order' => 'DESC',
'orderby' => 'date',
'meta_key' => 'brochure_pdf',
'meta_value' => '',
'meta_compare' => '!=',
// ICI METAQUERY FOR LE PDF
);
$brochuresPosts = new WP_Query($args);
// #### FICHES INFOS QUERY
$args = array(
'post_type' => 'fiches-infos',
'posts_per_page' => $posts_per_page,
'post_status' => 'publish',
'order' => 'DESC',
'orderby' => 'date',
'meta_key' => 'brochure_pdf',
'meta_value' => '',
'meta_compare' => '!=',
// ICI METAQUERY FOR LE PDF
);
$fichesInfosPosts = new WP_Query($args);
// #### VIDÉOS & WEBINAIRES QUERY
$videosWebinairesDatas = get_field('videos_webinaires', $current_page_id)['videos_webinaires_datas'] ?? null;
$total_posts_found = $brochuresPosts->found_posts + $fichesInfosPosts->found_posts + count($videosWebinairesDatas);
?>
<div class="template-archives template-archives--publications">
<?php /* ------------
BREADCRUMB
-----------------*/ ?>
<nav class="breadcrumbs_navigation" aria-label="breadcrumbs">
<ol>
<li><a href="<?php echo home_url() ?>">Home</a></li>
<li><a href="<?php echo get_post_type_archive_link('brochures') ?>" aria-current='location'>Publications</a></li>
</ol>
</nav>
<?php /* ---------
HEADING BOX
-----------------*/ ?>
<?php
get_template_part("template-components/heading-box", null, array(
"pageIcon" => $pageIcon,
"title" => get_the_title(get_queried_object_id()),
"description" => __("Découvrez toutes nos publications et outils en ligne", "homegrade-theme__texte-fonctionnel"),
));
?>
<?php /* -------
FILTERS
---------------*/ ?>
<div class="filters-toolbar filters-toolbar--archive-publications">
<div class="filters-toolbar__posts-results-indications">
<p class="filters-toolbar__posts-results-amount filter-disable" role="status">
<span class="results-amount">
<?php echo $total_posts_found ?>
</span>
<span class="results-text">
<?php echo __("résultat(s)", "homegrade-theme__texte-fonctionnel"); ?>
</span>
<span class="results-for">
<?php echo __("pour", "homegrade-theme__texte-fonctionnel") . " : "; ?>
</span>
<span class="results-filter-name">
<?php echo __("categorie", "homegrade-theme__texte-fonctionnel"); ?>
</span>
</p>
<button class="filters-toolbar__action-button--load-all" data-term-id="all" data-publication-type="all"><?php echo __("Afficher toutes les publications", "homegra-theme_texte-fonctionnel") ?></button>
</div>
<ul>
<li>
<button class="filters-toolbar__action-button" data-term-id="all" data-publication-type="all">Tous</button>
</li>
<li>
<button class="filters-toolbar__action-button" data-publication-type="brochures">
<img class="icon" src="<?php echo get_template_directory_uri() . '/resources/img/pictogrammes/pictogramme-brochures.svg' ?>" alt='' />
<?php echo __("Brochures thématiques", "homegrade-theme__texte-fonctionnel") ?>
</button>
</li>
<li>
<button class="filters-toolbar__action-button" data-publication-type="fiches-infos">
<img class="icon" src="<?php echo get_template_directory_uri() . '/resources/img/pictogrammes/pictogramme-fiches.svg' ?>" alt='' />
<?php echo __("Fiches Infos", "homegrade-theme__texte-fonctionnel") ?>
</button>
</li>
<li>
<button class="filters-toolbar__action-button" data-publication-type="webinaires">
<img class="icon" src="<?php echo get_template_directory_uri() . '/resources/img/pictogrammes/pictogramme-videos.svg' ?>" alt='' />
<?php echo __("Vidéos & Webinaires", "homegrade-theme__texte-fonctionnel") ?>
</button>
</li>
</ul>
</div>
<?php /* ---------------
HIGHLIGHTED BROCHURE
-----------------------*/ ?>
<div id="highlighted-document" class="highlighted-publication">
<?php
$highlightedDocumentDatas = get_field('highlighted_document', $current_page_id) ?? null;
$documentThumbnail = get_field('brochure_cover_image', $highlightedDocumentDatas['document']['ID']);
?>
<?php if ($highlightedDocumentDatas) : ?>
<div class="highlighted-publication__infos">
<div class="highlighted-publication__titling">
<div class="highlighted-publication__titling__icon">
<img src="<?php echo get_template_directory_uri() . '/resources/img/graphic-assets/house-homegrade-icon.svg' ?>" alt="">
</div>
<h3 class="highlighted-publication__titling__title">
<?php echo $highlightedDocumentDatas['highlight_title'] ?>
</h3>
</div>
<?php if ($highlightedDocumentDatas['commentary']) : ?>
<div class="highlighted-publication__comment"><?php echo $highlightedDocumentDatas['commentary'] ?></div>
<?php endif; ?>
<a class="cta cta--secondary cta--button" href="<?php echo $highlightedBrochurePdf['url'] ?>" target="_blank"><?php echo __("Consulter le PDF", "homegrade-theme__texte-fonctionnel__archive-publications") ?></a>
</div>
<?php if ($documentThumbnail) : ?>
<img class="highlighted-publication__cover" src='<?php echo $documentThumbnail['sizes']['large'] ?>' />
<?php endif; ?>
 
<?php endif; ?>
</div>
<?php /* ---------
BROCHURES
-----------------*/ ?>
<section class="brochures-archives">
<div class="section_titling section_titling--left">
<h2 class="section_titling__title"><?php echo __("Nos Brochures thématiques", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></h2>
<p class="section_titling__subtitle">Curabitur eleifend neque eu erat lacinia tincidunt</p>
</div>
<!-- BROCHURES GRID -->
<ul id="brochures-rows" class="publications-grid">
<?php
get_template_part(
'template-components/archives/brochure-rows',
null,
array(
'brochuresPosts' => $brochuresPosts,
)
)
?>
</ul>
<!-- LOAD MORE -->
<button id="load-more-brochures" class="cta cta--button cta--outline cta--button cta--centered cta--load-more" data-publication-type="brochures"><?php echo __("Consulter plus de brochures", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></button>
<?php wp_reset_postdata(); ?>
</section>
<?php /* -----------
FICHES INFOS
------------------*/ ?>
<section class="fiches-infos-archives">
<div class="section_titling section_titling--left">
<h2 class="section_titling__title"><?php echo __("Nos Fiches infos", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></h2>
<p class="section_titling__subtitle">Phasellus elit turpis, viverra id porta gravida</p>
</div>
<ul id="fiche-infos-rows" class="publications-grid">
<?php
get_template_part(
'template-components/archives/fiche-info-rows',
null,
array(
'fichesInfosPosts' => $fichesInfosPosts,
)
)
?>
</ul>
<button id="load-more-brochures" class="cta cta--button cta--outline cta--button cta--centered cta--load-more" data-publication-type="fiches-infos"><?php echo __("Consulter plus de fiches infos", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></button>
<?php wp_reset_postdata(); ?>
</section>
<?php /* ---------------
VIDÉOS & WEBINAIRES
-----------------------*/ ?>
<section class="videos-webinaires-archives">
<div class="section_titling section_titling--left">
<h2 class="section_titling__title"><?php echo __("Nos vidéos et webinaires", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></h2>
<p class="section_titling__subtitle">Phasellus elit turpis, viverra id porta gravida</p>
</div>
<?php
$highlightedWebinaire = get_field('highlighted_webinaire', $current_page_id) ?? null;
?>
<!-- HIGHLIGHTED WEBINAIRE -->
<div class="highlighted-publication">
<?php if ($highlightedWebinaire) : ?>
<div class="highlighted-publication__infos">
<div class="highlighted-publication__titling">
<div class="highlighted-publication__titling__icon">
<img src="<?php echo get_template_directory_uri() . '/resources/img/graphic-assets/house-homegrade-icon.svg' ?>" alt="">
</div>
<h3 class="highlighted-publication__titling__title">
<?php echo __("Sélection de nos conseillers", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?>
</h3>
</div>
<?php if ($highlightedWebinaire['title']) : ?>
<h4 class="highlighted-publication__titling__subtitle"><?php echo $highlightedWebinaire['title'] ?></h4>
<?php endif; ?>
<?php if ($highlightedWebinaire['commentary']) : ?>
<p class="highlighted-publication__comment"><?php echo $highlightedWebinaire['commentary'] ?></p>
<?php endif; ?>
<a class="cta cta--secondary cta--button" href="<?php echo $highlightedWebinaire['url'] ?>" target="_blank"><?php echo __("Consulter la vidéo", "homegrade-theme__texte-fonctionnel__archive-publications") ?></a>
</div>
<?php if ($highlightedWebinaire['thumbnail']) : ?>
<div class="highlighted-publication__thumbnail-cover">
<img src='<?php echo $highlightedWebinaire['thumbnail']['url'] ?>' alt="<?php echo $highlightedWebinaire['thumbnail']['alt'] ?>" />
</div>
<?php endif; ?>
<?php if ($highlightedWebinaire['embed']) : ?>
<?php echo $highlightedWebinaire['embed'] ?>
<?php endif; ?>
<?php endif; ?>
</div>
<ul id="webinaires-rows" class="publications-grid publications-grid--webinaires">
<?php
get_template_part(
'template-components/archives/webinaire-rows',
null,
array(
'videosWebinairesDatas' => $videosWebinairesDatas,
)
)
?>
</ul>
<!-- <button id="load-more-brochures" class="cta cta--button cta--outline cta--button cta--centered cta--load-more" target="_blank"><?php echo __("Consulter plus de fiches infos", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></button> -->
<?php wp_reset_postdata(); ?>
</section>
</div>
<?php
get_footer();