carhop__plugins__PROD-DEV/plugins/carhop-blocks/build/dbmob-archives/render.php
2026-03-25 16:00:57 +01:00

50 lines
1.3 KiB
PHP

<?php
$args = array(
'post_type' => 'dbmob',
'posts_per_page' => -1,
);
$query = new WP_Query($args);
$post_count = $query->found_posts;
?>
<section <?php echo get_block_wrapper_attributes(); ?>>
<h2>Les notices rédigées par le CARHOP</h2>
<div class="notice-toolbar">
<h2 class="post-count">
<span class="post-count__count">
<?php echo $post_count; ?>
</span>
<span class="post-count__text">
<?php _e('notices biographiques', 'carhop-blocks'); ?>
</span>
</h2>
<div class="search-bar">
<label for="search-input"><?php _e('Rechercher une notice par nom', 'carhop-blocks'); ?></label>
<input type="text" placeholder="<?php _e('Rechercher par nom', 'carhop-blocks'); ?>">
</div>
</div>
<?php if ($query->have_posts()) : ?>
<div class="dbmob-grid">
<?php while ($query->have_posts()) : $query->the_post(); ?>
<?php $maitron_url = get_field('maitron_url', get_the_ID()); ?>
<?php get_template_part('template-parts/components/cards/post-card', null, array(
'ID' => get_the_ID(),
'current_post_type' => 'dbmob',
'has_external_link' => isset($maitron_url) && !empty($maitron_url),
'external_link' => $maitron_url,
'external_link_text' => 'Voir la notice',
)); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</section>