Sindbad~EG File Manager
<?php get_header(); ?>
<main class="blog">
<?php
$category = get_queried_object(); // Récupère la catégorie actuelle
$hero = get_field('hero', 411); // Récupération des champs ACF si nécessaire
?>
<section class="blog__hero">
<div class="container">
<div class="blog__hero-container">
<div class="blog__hero-subcontainer">
<p class="subheading text-purple200">
<?php echo esc_html($hero['surtitle']); ?>
</p>
<h1 class="heading-1 text-white font-bold mb-12">
<?php echo esc_html($category->name); ?>
</h1>
<p class="body-3 text-purple300 mb-32">
<?php echo esc_html($hero['content']); ?>
</p>
<div class="blog__form-container">
<?php echo do_shortcode($hero['form']); ?>
</div>
<div class="flex gap-8 mt-8">
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/article/info.svg"
class="" />
<p class="single-article__newsletter-policy">
Accédez à nos <a href="#">politiques de confidentialité</a>
</p>
</div>
</div>
<div class="blog__hero-subcontainer">
<img src="<?php echo esc_url($hero['image']); ?>" alt="hero image" class="blog__hero-image">
</div>
</div>
</div>
</section>
<section class="blog__section-2">
<div class="container">
<div class="blog__section-2-categories mb-24">
<a href="/blog" class="blog__section-2-category <?= !is_category() ? 'active' : ''; ?>">
Tout
</a>
<?php
$categories = get_categories();
$current_category = get_queried_object();
?>
<?php foreach ($categories as $category): ?>
<a href="<?= get_category_link($category->term_id); ?>"
class="blog__section-2-category <?= (is_category() && $current_category->term_id === $category->term_id) ? 'active' : ''; ?>">
<?= $category->name; ?>
</a>
<?php endforeach; ?>
</div>
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'post',
'posts_per_page' => 6,
'paged' => $paged,
'cat' => $category->term_id,
'order' => 'DESC',
'orderby' => 'date'
);
$query = new WP_Query($args);
?>
<div class="blog__section-2-items-container">
<?php if ($query->have_posts()): ?>
<?php while ($query->have_posts()):
$query->the_post(); ?>
<?php $post_category = get_the_category()[0]; ?>
<?php $post_reading_time = do_shortcode('[rt_reading_time post_id="' . get_the_ID() . '"]'); ?>
<article class="blog__section-2-item">
<a href="<?= get_the_permalink(); ?>" class="blog__section-2-item-container">
<div class="blog__section-2-item-image-container">
<img src="<?= get_the_post_thumbnail_url(); ?>" alt="Article Image"
class="blog__section-2-item-image">
</div>
<div class="blog__section-2-item-content">
<div class="flex items-center justify-between">
<p class="body-1 text-purple500 mb-8 blog__section-2-category">
<?= esc_html($post_category->name); ?>
</p>
<div class="flex items-center gap-8 mb-16">
<p class="body-1 text-purple800">
<svg xmlns="http://www.w3.org/2000/svg" width="17" height="16" fill="none">
<path stroke="#180835" stroke-linecap="round" stroke-linejoin="round"
d="M8.669 4v4l2.666 1.334m4-1.334A6.667 6.667 0 1 1 2.002 8a6.667 6.667 0 0 1 13.333 0Z" />
</svg>
<?= $post_reading_time; ?> min
</p>
</div>
</div>
<div class="blog__section-2-item-title-container mb-16">
<h4 class="blog__section-2-item-title text-purple800">
<?= get_the_title(); ?>
</h4>
</div>
<p class="body-1 font-regular text-purple800 mb-24">
<?= get_the_excerpt(); ?>
</p>
<?php if (function_exists('kk_star_ratings')): ?>
<div class="blog__section-2-rating">
<?php echo kk_star_ratings(get_the_ID()); ?>
</div>
<?php endif; ?>
</div>
</a>
</article>
<?php endwhile; ?>
<?php else: ?>
<p>Aucun article trouvé.</p>
<?php endif; ?>
</div>
<!-- Pagination -->
<div class="pagination">
<?php
$prev_link = get_previous_posts_link('< Précédent');
$next_link = get_next_posts_link('Suivant >', $query->max_num_pages);
if (!$prev_link) {
echo '<div class="prev-placeholder"></div>';
}
echo paginate_links(array(
'total' => $query->max_num_pages,
'current' => max(1, get_query_var('paged')),
'format' => '?paged=%#%',
'prev_text' => '< Précédent',
'next_text' => 'Suivant >',
));
if (!$next_link) {
echo '<div class="next-placeholder"></div>';
}
?>
</div>
</div>
<?php wp_reset_postdata(); ?>
</section>
</main>
<?php get_footer(); ?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists