FEATURE introducing component
This commit is contained in:
parent
6372714ff6
commit
6e6a3d4fbe
73
template-parts/articles/articles-grid.php
Normal file
73
template-parts/articles/articles-grid.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
$articles = new WP_Query(array(
|
||||
'post_type' => 'articles',
|
||||
'posts_per_page' => -1
|
||||
));
|
||||
$post_count = $articles->post_count;
|
||||
$authors = get_posts(array(
|
||||
'post_type' => 'auteurs',
|
||||
'posts_per_page' => -1
|
||||
));
|
||||
|
||||
$thematiques = get_terms(array(
|
||||
'taxonomy' => 'etiquettes',
|
||||
'hide_empty' => true,
|
||||
));
|
||||
?>
|
||||
|
||||
<section class="post-grid articles-grid content-section">
|
||||
<div class="content-section__inner">
|
||||
|
||||
<div class="post-grid__toolbar">
|
||||
<h2 class="post-count">
|
||||
<span class="post-count__count">
|
||||
<?php echo $post_count; ?>
|
||||
</span>
|
||||
<span class="post-count__text">
|
||||
<?php _e('Articles', 'dynamiques'); ?>
|
||||
</span>
|
||||
</h2>
|
||||
|
||||
<div class="search-bar">
|
||||
<input type="text" placeholder="<?php _e('Rechercher par mot-clé', 'dynamiques'); ?>">
|
||||
</div>
|
||||
|
||||
<div class="post-grid__toolbar-actions">
|
||||
|
||||
<select name="etiquettes">
|
||||
<option value="1"><?php _e('Thématiques', 'dynamiques'); ?></option>
|
||||
<?php foreach ($thematiques as $thematique) : ?>
|
||||
<option value="<?php echo $thematique->term_id; ?>"><?php echo $thematique->name; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<select name="auteurs">
|
||||
<option value="1"><?php _e('Auteur·e·s', 'dynamiques'); ?></option>
|
||||
<?php foreach ($authors as $author) : ?>
|
||||
<option value="<?php echo $author->ID; ?>"><?php echo $author->post_title; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
<select name="sort_by">
|
||||
<option value="recent" selected><?php _e('Numéros récents en premier', 'dynamiques'); ?></option>
|
||||
<option value="oldest"><?php _e('Numéros anciens en premier', 'dynamiques'); ?></option>
|
||||
<option value="alphabetical"><?php _e('Par ordre alphabétique', 'dynamiques'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<ul class="post-grid__list">
|
||||
|
||||
<?php if ($articles->have_posts()) : ?>
|
||||
<?php while ($articles->have_posts()) : $articles->the_post(); ?>
|
||||
<?php get_template_part('template-parts/articles/card-article', null, array(
|
||||
|
||||
'date' => get_the_date(),
|
||||
'image' => get_the_post_thumbnail_url(),
|
||||
'link' => get_the_permalink(),
|
||||
'ID' => get_the_ID()
|
||||
)); ?>
|
||||
<?php endwhile; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
Loading…
Reference in New Issue
Block a user