refining puclications page

This commit is contained in:
Antoine M 2023-11-20 14:13:26 +01:00
parent f79db534c7
commit 1cec7773ac
2 changed files with 264 additions and 131 deletions

View File

@ -1,35 +1,23 @@
.archives-publications-header {
.template-archives--publications {
.archives-publications-header {
@apply bg-primary max-w-screen-xl text-white text-center mx-auto;
}
.highlighted-brochure {
}
.highlighted-publication {
@apply max-w-screen-xl
mb-10
p-8
mx-auto
mt-0
bg-secondary-light;
/* &__infos {
&:after {
@apply absolute
left-0
bottom-0
w-full
bg-secondary-light;
content: '';
height: 200px;
z-index: -1;
}
} */
&__wrapper {
@apply relative
rounded-2xl
bg-secondary-light
flex
flex-row
items-end
justify-between;
items-center
justify-around;
&__infos {
}
&__titling {
@apply flex items-center gap-4;
@apply flex items-center gap-4 w-fit;
&__icon {
@apply bg-secondary rounded-full w-8 h-8 flex items-center justify-center;
img {
@ -42,21 +30,23 @@
}
}
&__comment {
@apply pt-4 w-2/3 max-w-5xl pr-6;
@apply pt-4 max-w-3xl pr-6 text-secondary;
line-height: 1.6;
}
&__cover {
@apply absolute right-0 bottom-0;
/* transform: translateY(-30%); */
@apply w-1/3;
max-width: 250px;
@apply rounded-2xl;
max-width: 200px;
/* transform: scale(2) translate(-50%, -20%); */
}
.cta {
@apply mt-8;
}
}
.brochures-archives,
.fiches-infos-archives {
}
.brochures-archives,
.fiches-infos-archives {
@apply max-w-screen-xl mx-auto py-4 mt-8;
}
}

View File

@ -1,9 +1,66 @@
<?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
$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);
$total_posts_found = $brochuresPosts->found_posts + $fichesInfosPosts->found_posts + 100;
?>
<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>
@ -12,12 +69,73 @@ $current_page_id = get_queried_object_id();
</nav>
<section class="archive-page-header">
<h1 class="archive-page-header__title"><?php echo __("Nos publications", "homegrade-theme__texte-fonctionnel__archive-publications") ?></h1>
<p class="archive-page-header__description"><?php echo __("Découvrez toutes nos publications et outils en ligne", "homegrade-theme__texte-fonctionnel__archive-publications") ?>
<?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-news">
<p class="filters-toolbar__posts-results-amount filter-disable" role="status">
<span class="results-amount">
<?php echo $posts->found_posts ?>
</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>
<?php get_search_form(); ?>
</section>
<ul>
<li>
<button class="filters-toolbar__action-button" data-term-id="all" data-term-name="all">Tous</button>
</li>
<li>
<button class="filters-toolbar__action-button" data-term-id="brochure-thématique" data-term-name="all">
<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-term-id="fiches-infos" data-term-name="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-term-id="all" data-term-name="all">
<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 /* ---------
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>
<?php
$highlightedBrochureRelatedPost = get_field('highlighted_brochure', $current_page_id) ?? null;
$highlightedBrochurePdf = get_field('brochure_pdf', $highlightedBrochureRelatedPost->ID) ?? null;
@ -25,67 +143,60 @@ $current_page_id = get_queried_object_id();
$highlightedBrochureComment = get_field('highlighted_brochure_comment', $current_page_id) ?? null;
?>
<?php if ($highlightedBrochurePdf) : ?>
<div class="highlighted-brochure">
<div class="highlighted-brochure__wrapper">
<div class="highlighted-brochure__infos">
<div class="highlighted-publication">
<div class="highlighted-publication__infos">
<div class="highlighted-brochure__titling">
<div class="highlighted-brochure__titling__icon">
<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-brochure__titling__title">
<h3 class="highlighted-publication__titling__title">
<?php echo __("Sélection de nos conseillers", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?>
</h3>
</div>
<?php if ($highlightedBrochureComment) : ?>
<p class="highlighted-brochure__comment"><?php echo $highlightedBrochureComment ?></p>
<p class="highlighted-publication__comment"><?php echo $highlightedBrochureComment ?></p>
<?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 ($highlightedBrochureCover) : ?>
<img class="highlighted-brochure__cover" src='<?php echo $highlightedBrochureCover['sizes']['large'] ?>' />
<img class="highlighted-publication__cover" src='<?php echo $highlightedBrochureCover['sizes']['large'] ?>' />
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<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>
<?php
$args = array(
'post_type' => 'brochures',
'posts_per_page' => 1,
'post_status' => 'publish',
'order' => 'DESC',
'orderby' => 'date',
'meta_key' => 'brochure_pdf',
'meta_value' => '',
'meta_compare' => '!=',
// ICI METAQUERY FOR LE PDF
);
$brochures = new WP_Query($args);
?>
<ul class="brochures-grid">
<?php if ($brochures->have_posts()) : while ($brochures->have_posts()) : $brochures->the_post(); ?>
<?php if ($brochuresPosts->have_posts()) : while ($brochuresPosts->have_posts()) : $brochuresPosts->the_post(); ?>
<?php
get_template_part('template-components/archives/brochure-grid-row', null, array('ID' => get_the_ID()));
$brochurePdf = get_field('brochure_pdf', $args['ID']);
$brochureCover = get_field('brochure_cover_image', $brochurePdf['ID']);
$brochureEdition = get_field('brochure_edition', $args['ID']);
$thematique = get_the_terms($args['ID'], 'thematiques')[0];
$rootThematic = getParentThematique($thematique);
?>
<li class="publications-grid__row">
<?php if ($brochureCover) : ?>
<img class="publications-grid__cover" src="<?php echo $brochureCover['sizes']['medium'] ?>" />
<?php endif; ?>
<h2 class="publications-grid__title"><?php echo $brochurePdf['title'] ?></h2>
<p class="publications-grid__thematique thematique-tag thematique-tag--<?php echo $rootThematic->slug ?>"><?php echo $rootThematic->name ?></p>
<?php if ($brochureEdition) : ?>
<p class="publications-grid__edition"><?php echo $brochureEdition ?></p>
<?php endif; ?>
<div class="publications-grid__button">
<a href="<?php echo $brochurePdf['url'] ?>" class=" cta cta--secondary cta--button" href="#" target="_blank"><?php echo __("Consulter le pdf", "homegrade-theme__texte-fonctionnel__publications-archive") ?></a>
</div>
</li>
<?php endwhile ?>
<?php endif; ?>
</ul>
<button id="load-more-brochures" class="cta cta--button cta--shadowed" target="_blank"><?php echo __("Consulter plus de brochures", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></button>
<?php wp_reset_postdata(); ?>
@ -93,49 +204,82 @@ $current_page_id = get_queried_object_id();
</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>
<?php
$args = array(
'post_type' => 'fiches-infos',
'posts_per_page' => 1,
'post_status' => 'publish',
'order' => 'DESC',
'orderby' => 'date',
'meta_key' => 'brochure_pdf',
'meta_value' => '',
'meta_compare' => '!=',
// ICI METAQUERY FOR LE PDF
);
$fiches_infos = new WP_Query($args);
?>
<ul class="publications-grid">
<?php if ($fiches_infos->have_posts()) : while ($fiches_infos->have_posts()) : $fiches_infos->the_post(); ?>
<?php if ($fichesInfosPosts->have_posts()) : while ($fichesInfosPosts->have_posts()) : $fichesInfosPosts->the_post(); ?>
<?php
$ficheInfoPdf = get_field('brochure_pdf', get_the_ID());
// $ficheInfoCover = get_field('brochure_cover', get_the_ID());
$ficheInfoCover = get_field('brochure_cover_image', $ficheInfoPdf['ID']);
// $ficheInfoCover = get_field('brochure_cover_image', $ficheInfoPdf['ID']);
$ficheInfoEdition = get_field('brochure_edition', get_the_ID());
$thematique = get_the_terms(get_the_ID(), 'thematiques')[0];
$rootThematic = getParentThematique($thematique);
$rootThematicIcon = get_field('taxonomy_pictures', "thematiques_" . $rootThematic->term_id)['icon'] ?? null;
?>
<li class="publications-grid__row">
<p>missing the cover</p>
<?php if ($ficheInfoCover) : ?>
<img class="brochures-grid__cover" src="<?php echo $ficheInfoCover['sizes']['medium'] ?>" />
<?php if ($rootThematicIcon) : ?>
<img class="publications-grid__icon" src="<?php echo $rootThematicIcon['url'] ?>" />
<?php endif; ?>
<h2 class="publications-grid__title"><?php echo $ficheInfoPdf['title'] ?></h2>
<p class="publications-grid__thematique"><?php echo $rootThematic->name ?></p>
<h2 class="publications-grid__title"><?php echo get_the_title() ?></h2>
<p class="publications-grid__thematique thematique-tag thematique-tag--<?php echo $rootThematic->slug ?>"><?php echo $rootThematic->name ?></p>
<?php if ($ficheInfoEdition) : ?>
<p class="publications-grid__edition"><?php echo $ficheInfoEdition ?></p>
<?php endif; ?>
<div class="publications-grid__button">
<a href="<?php echo $brochurePdf['url'] ?>" class=" cta cta--secondary cta--button" href="#" target="_blank"><?php echo __("Consulter le pdf", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></a>
</div>
</li>
<?php endwhile ?>
<?php endif; ?>
</ul>
<button id="load-more-brochures" class="cta cta--button cta--shadowed" target="_blank"><?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>
<ul class="publications-grid">
<?php if ($fichesInfosPosts->have_posts()) : while ($fichesInfosPosts->have_posts()) : $fichesInfosPosts->the_post(); ?>
<?php
$ficheInfoPdf = get_field('brochure_pdf', get_the_ID());
// $ficheInfoCover = get_field('brochure_cover', get_the_ID());
// $ficheInfoCover = get_field('brochure_cover_image', $ficheInfoPdf['ID']);
$ficheInfoEdition = get_field('brochure_edition', get_the_ID());
$thematique = get_the_terms(get_the_ID(), 'thematiques')[0];
$rootThematic = getParentThematique($thematique);
$rootThematicIcon = get_field('taxonomy_pictures', "thematiques_" . $rootThematic->term_id)['icon'] ?? null;
?>
<li class="publications-grid__row">
<?php if ($rootThematicIcon) : ?>
<img class="publications-grid__icon" src="<?php echo $rootThematicIcon['url'] ?>" />
<?php endif; ?>
<h2 class="publications-grid__title"><?php echo get_the_title() ?></h2>
<p class="publications-grid__thematique thematique-tag thematique-tag--<?php echo $rootThematic->slug ?>"><?php echo $rootThematic->name ?></p>
<?php if ($ficheInfoEdition) : ?>
<p class="publications-grid__edition"><?php echo $ficheInfoEdition ?></p>
<?php endif; ?>
@ -154,7 +298,6 @@ $current_page_id = get_queried_object_id();
</div>