<?php
$current = absint(
max(
1,
get_query_var( 'paged' ) ? get_query_var( 'paged' ) : get_query_var( 'page' )
)
);
$posts_per_page = 3;
$query = new WP_Query(
[
'post_type' => 'job',
'posts_per_page' => $posts_per_page,
'paged' => $current,
'orderby' => [ 'meta_value_num'=>'ASC' ]
]
);
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
?>
<div class="job_item">
<p class="jobs_title"><?php the_field('jobs__title') ?></p>
<p class="jobs_descript"><?php the_field('jobs__description') ?></p>
<p class="jobs_descript_full"><?php the_field('jobs__more__description') ?></p>
<a class="jobs_more">Подробнее <span><ion-icon name="chevron-down-outline"></ion-icon></span></a>
</div>
<?php
}
wp_reset_postdata();
echo wp_kses_post(
paginate_links(
[
'total' => $query->max_num_pages,
'current' => $current,
]
)
);
} else {
global $wp_query;
$wp_query->set_404();
status_header( 404 );
nocache_headers();
require get_404_template();
}
?>