FEATURE Using a reusable component article-card
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3c08c72aaf
commit
d1959de540
|
|
@ -20,6 +20,7 @@ $issueNumber = get_field('issue_number', $last_issue->ID);
|
|||
$issue_related_articles = get_field('articles', $last_issue->ID);
|
||||
?>
|
||||
|
||||
|
||||
<section class="block-dernieres-dynamiques content-section ">
|
||||
<div class="block-dernieres-dynamiques__inner">
|
||||
<div class="block-dernieres-dynamiques__header">
|
||||
|
|
@ -85,91 +86,32 @@ $issue_related_articles = get_field('articles', $last_issue->ID);
|
|||
<div class="article-caroussel article-caroussel--<?php echo $displayType; ?>">
|
||||
|
||||
<?php if ($displayType === 'grid') : ?>
|
||||
<?php foreach ($issue_related_articles->posts as $article) : ?>
|
||||
|
||||
<div class="article-card">
|
||||
<div class="content-meta">
|
||||
<span class="content-meta__type content-meta__type--article">Article</span>
|
||||
<!-- <span class="content-meta__reading-time"><?php echo calculate_reading_time($article->post_content); ?> minutes de lecture</span> -->
|
||||
</div>
|
||||
|
||||
|
||||
<a href="<?php echo get_the_permalink($article->ID); ?>" class="article-card__link">
|
||||
|
||||
<h4 class="article-card__title"><?php echo $article->post_title; ?></h4>
|
||||
</a>
|
||||
|
||||
<ul class="article-card__tags">
|
||||
<?php foreach ($issue_related_articles as $article) : ?>
|
||||
<?php
|
||||
$terms = get_the_terms($article->ID, 'etiquettes');
|
||||
if ($terms): ?>
|
||||
<?php foreach ($terms as $term): ?>
|
||||
<li class="article-card__tag article-tag"><?php echo esc_html($term->name); ?></li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
get_template_part('template-parts/dynamiques/article-card', null, array(
|
||||
'ID' => $article->ID,
|
||||
|
||||
</ul>
|
||||
<a class="article-card__link-button" href="<?php echo get_the_permalink($article->ID); ?>">
|
||||
|
||||
<?php
|
||||
$svg_path = get_template_directory() . '/resources/img/carhop-fleche-full.svg';
|
||||
if (file_exists($svg_path)) {
|
||||
echo file_get_contents($svg_path);
|
||||
}
|
||||
));
|
||||
?>
|
||||
</a>
|
||||
|
||||
|
||||
</div>
|
||||
<button class="related-articles__show-all">
|
||||
Tout afficher
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
<!-- <button class="related-articles__show-all">
|
||||
Tout afficher
|
||||
</button> -->
|
||||
<?php else : ?>
|
||||
|
||||
<div class="article-caroussel__slider">
|
||||
<?php if ($issue_related_articles && is_array($issue_related_articles)) : ?>
|
||||
|
||||
|
||||
<div class="swiper dernieres-dynamiques-swiper">
|
||||
<div class="swiper-wrapper">
|
||||
<?php foreach (
|
||||
$issue_related_articles as $article
|
||||
) : ?>
|
||||
<article class="article-card swiper-slide">
|
||||
<div class="content-meta">
|
||||
<span class="content-meta__type content-meta__type--article">Article</span>
|
||||
</div>
|
||||
<div class="article-card__content">
|
||||
<h4 class="article-card__title title"><a href="<?php echo get_the_permalink($article->ID); ?>"><?php echo get_the_title($article->ID); ?></a></h4>
|
||||
<?php
|
||||
$etiquettes = get_the_terms($article->ID, 'etiquettes');
|
||||
if ($etiquettes): ?>
|
||||
<ul class="article-tags-list">
|
||||
|
||||
<?php foreach ($etiquettes as $etiquette): ?>
|
||||
<li class="article-card__tag article-tag"><?php echo esc_html($etiquette->name); ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php get_template_part('template-parts/components/cta--go', null, array(
|
||||
'url' => get_the_permalink(),
|
||||
'label' => 'Lire la revue',
|
||||
'target' => '_self',
|
||||
)); ?>
|
||||
</div>
|
||||
|
||||
<div class="card-revue__issue-thumbnail-wrapper">
|
||||
<?php $post_thumbnail_id = get_the_post_thumbnail(get_the_ID(), 'full'); ?>
|
||||
<div class="card-revue__issue-thumbnail">
|
||||
<?php if ($post_thumbnail_id) : ?>
|
||||
<?php echo $post_thumbnail_id; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="card-background"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</article>
|
||||
<?php foreach ($issue_related_articles as $article) : ?>
|
||||
|
||||
<?php get_template_part('template-parts/dynamiques/article-card', null, array(
|
||||
'ID' => $article->ID,
|
||||
'isSwiperSlide' => true,
|
||||
)) ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ $issueNumber = get_field('issue_number', $last_issue->ID);
|
|||
$issue_related_articles = get_field('articles', $last_issue->ID);
|
||||
?>
|
||||
|
||||
|
||||
<section class="block-dernieres-dynamiques content-section ">
|
||||
<div class="block-dernieres-dynamiques__inner">
|
||||
<div class="block-dernieres-dynamiques__header">
|
||||
|
|
@ -85,91 +86,32 @@ $issue_related_articles = get_field('articles', $last_issue->ID);
|
|||
<div class="article-caroussel article-caroussel--<?php echo $displayType; ?>">
|
||||
|
||||
<?php if ($displayType === 'grid') : ?>
|
||||
<?php foreach ($issue_related_articles->posts as $article) : ?>
|
||||
|
||||
<div class="article-card">
|
||||
<div class="content-meta">
|
||||
<span class="content-meta__type content-meta__type--article">Article</span>
|
||||
<!-- <span class="content-meta__reading-time"><?php echo calculate_reading_time($article->post_content); ?> minutes de lecture</span> -->
|
||||
</div>
|
||||
|
||||
|
||||
<a href="<?php echo get_the_permalink($article->ID); ?>" class="article-card__link">
|
||||
|
||||
<h4 class="article-card__title"><?php echo $article->post_title; ?></h4>
|
||||
</a>
|
||||
|
||||
<ul class="article-card__tags">
|
||||
<?php foreach ($issue_related_articles as $article) : ?>
|
||||
<?php
|
||||
$terms = get_the_terms($article->ID, 'etiquettes');
|
||||
if ($terms): ?>
|
||||
<?php foreach ($terms as $term): ?>
|
||||
<li class="article-card__tag article-tag"><?php echo esc_html($term->name); ?></li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
get_template_part('template-parts/dynamiques/article-card', null, array(
|
||||
'ID' => $article->ID,
|
||||
|
||||
</ul>
|
||||
<a class="article-card__link-button" href="<?php echo get_the_permalink($article->ID); ?>">
|
||||
|
||||
<?php
|
||||
$svg_path = get_template_directory() . '/resources/img/carhop-fleche-full.svg';
|
||||
if (file_exists($svg_path)) {
|
||||
echo file_get_contents($svg_path);
|
||||
}
|
||||
));
|
||||
?>
|
||||
</a>
|
||||
|
||||
|
||||
</div>
|
||||
<button class="related-articles__show-all">
|
||||
Tout afficher
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
<!-- <button class="related-articles__show-all">
|
||||
Tout afficher
|
||||
</button> -->
|
||||
<?php else : ?>
|
||||
|
||||
<div class="article-caroussel__slider">
|
||||
<?php if ($issue_related_articles && is_array($issue_related_articles)) : ?>
|
||||
|
||||
|
||||
<div class="swiper dernieres-dynamiques-swiper">
|
||||
<div class="swiper-wrapper">
|
||||
<?php foreach (
|
||||
$issue_related_articles as $article
|
||||
) : ?>
|
||||
<article class="article-card swiper-slide">
|
||||
<div class="content-meta">
|
||||
<span class="content-meta__type content-meta__type--article">Article</span>
|
||||
</div>
|
||||
<div class="article-card__content">
|
||||
<h4 class="article-card__title title"><a href="<?php echo get_the_permalink($article->ID); ?>"><?php echo get_the_title($article->ID); ?></a></h4>
|
||||
<?php
|
||||
$etiquettes = get_the_terms($article->ID, 'etiquettes');
|
||||
if ($etiquettes): ?>
|
||||
<ul class="article-tags-list">
|
||||
|
||||
<?php foreach ($etiquettes as $etiquette): ?>
|
||||
<li class="article-card__tag article-tag"><?php echo esc_html($etiquette->name); ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php get_template_part('template-parts/components/cta--go', null, array(
|
||||
'url' => get_the_permalink(),
|
||||
'label' => 'Lire la revue',
|
||||
'target' => '_self',
|
||||
)); ?>
|
||||
</div>
|
||||
|
||||
<div class="card-revue__issue-thumbnail-wrapper">
|
||||
<?php $post_thumbnail_id = get_the_post_thumbnail(get_the_ID(), 'full'); ?>
|
||||
<div class="card-revue__issue-thumbnail">
|
||||
<?php if ($post_thumbnail_id) : ?>
|
||||
<?php echo $post_thumbnail_id; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="card-background"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</article>
|
||||
<?php foreach ($issue_related_articles as $article) : ?>
|
||||
|
||||
<?php get_template_part('template-parts/dynamiques/article-card', null, array(
|
||||
'ID' => $article->ID,
|
||||
'isSwiperSlide' => true,
|
||||
)) ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user