<?php
// Template name: Careers page
get_header();
$srcset = get_template_directory_uri() . "/assets/images/lazyload.png";
?>
<main>
<?php
get_template_part('templates/inner-page-main');
?>
<?php
$block_with_photo = get_field('block_with_photo');
if ($block_with_photo['text'] && $block_with_photo['img']) :
?>
<section class="careers-main-section <?php echo get_section_color($block_with_photo['block_color']); ?>">
<div class="container -smaller">
<div class="careers-main-content">
<div class="careers-main-content__img">
<img class="-lazyload" srcset="<?php echo $srcset; ?>" src="<?php echo $block_with_photo['img']['url']; ?>" alt="<?php echo $block_with_photo['img']['alt']; ?>" />
</div>
<div class="careers-main-content__content editor">
<?php echo $block_with_photo['text']; ?>
</div>
</div>
</div>
</section>
<?php
endif;
$our_values = get_field('our_values');
if ($our_values['title'] && $our_values['values']) :
?>
<section class="careers-values <?php echo get_section_color($our_values['block_color']); ?>">
<div class="container -smaller">
<h2 class="title title-2 mob-title-2 -centered-title"><?php echo $our_values['title']; ?></h2>
<div class="careers-values-list">
<?php
foreach($our_values['values'] as $item) :
if ($item['img'] && $item['title']) :
?>
<div class="careers-values__item">
<div class="careers-values__img">
<img class="-lazyload" srcset="<?php echo $srcset; ?>" src="<?php echo $item['img']['url']; ?>" alt="<?php echo $item['img']['alt']; ?>" />
</div>
<div class="careers-value__content">
<p class="text-1 mob-text-1 careers-values__title --demi-bold"><?php echo $item['title']; ?></p>
<?php
if ($item['text']) :
?>
<p class="text-2 mob-text-2 careers-values__text">
<?php echo $item['text']; ?>
</p>
<?php
endif;
?>
</div>
</div>
<?php
endif;
endforeach;
?>
</div>
</div>
</section>
<?php
endif;
$vacancies = get_field('vacancies');
$roles_category = get_terms([
'taxonomy' => 'vacancy_type',
'hide_empty' => true,
]);
if ($vacancies['title'] && !empty($roles_category)) :
$roles_text = $vacancies['open_roles_text'];
?>
<section class="careers-vacancies <?php echo get_section_color($vacancies['block_color']); ?>">
<div class="container -smaller">
<h2 class="title title-2 mob-title-2 -centered-title"><?php echo $vacancies['title']; ?></h2>
<?php
foreach($roles_category as $role) :
$posts = new WP_query([
'post_type' => 'vacancy',
'tax_query' => [[
'taxonomy' => 'vacancy_type',
'terms' => $role->term_id,
]]
]);
?>
<div class="vacancies-list -max-width-1120">
<div class="vacancies-list__theme">
<h3 class="title title-3 mob-title-3"><?php echo $role->name; ?></h3>
<p class="text text-2 mob-text-2 --demi-bold"><?php echo count($posts->posts) . ' '; if (count($posts->posts) == 1) echo $roles_text['singular_role']; else echo $roles_text['plural_roles'] ?></p>
</div>
<?php
if ($role->description) :
?>
<p class="text text-2 mob-text-2">
<?php echo $role->description; ?>
</p>
<?php
endif;
?>
<div class="vacancies-list__list">
<?php
foreach($posts->posts as $post) :
$title = $post->post_title . ' - ' . $role->name;
$workplace = get_field('vacancy_description', $post)['workplace'];
?>
<a href="<?php echo get_the_permalink($post->ID); ?>" class="vacancies-list__item">
<p class="title text-2 mob-text-3 --demi-bold"><?php echo $title; ?></p>
<p class="text text-2 mob-text-3"><?php echo $workplace; ?></p>
</a>
<?php
endforeach;
?>
</div>
</div>
<?php
endforeach;
?>
</div>
</section>
<?php
endif;
?>
</main>
<?php
get_footer();
?>