homegrade_blocks_production/blocks/offres-emplois/build/render.php
2023-11-29 20:20:59 +01:00

43 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$args = array(
'post_type' => 'jobs',
'posts_per_page' => -1,
'status' => 'publish',
);
$offresEmplois = new WP_Query($args);
?>
<section <?php echo get_block_wrapper_attributes(["class" => "homegrade-blocks-offres-emplois"]); ?>>
<?php echo $content; ?>
<?php if (!$offresEmplois->have_posts()) : ?>
<p><?php echo __("Il ny a pas de poste à pourvoir en ce moment.", "homegrade-theme__texte-fonctionnel") ?></p>
<?php endif; ?>
<?php if ($offresEmplois->have_posts()) : ?>
<ul class="homegrade-blocks-offres-emplois__offres-grid-datas">
<div class="table_head">
<p><?php echo __("Poste", "homegrade-blocks") ?></p>
<p><?php echo __("Offre", "homegrade-blocks") ?></p>
</div>
<?php foreach ($offresEmplois->posts as $offre) : ?>
<?php
$contractType = get_field("contract_type", $offre->ID) ? get_field("contract_type", $offre->ID)['label'] : null;
$offrePermalink = get_the_permalink($offre->ID);
get_the_content($offre->ID);
?>
<li class="homegrade-blocks-offres-emplois__offre">
<p class="homegrade-blocks-offres-emplois__offre-title"><a href="<?php echo $offrePermalink ?>"><?php echo $offre->post_title ?></a></p>
<p class="homegrade-blocks-offres-emplois__offre-type"><?php echo $contractType ?></p>
<a class="homegrade-blocks-offres-emplois__offre-download cta cta--secondary cta--button" href="<?php echo $offrePermalink ?>"><?php echo __("Consulter l'offre", "homegrade-blocks") ?></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</section>