php args post_type masters orderby name order ASC posts get_posts args

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
$args = [
'post_type' => 'masters',
'orderby' => 'name',
'order' => 'ASC'
];
$posts = get_posts($args);
?>
<?php foreach ($posts as $post): ?>
<?php setup_postdata($post) ?>
<?
echo the_field('master_vozrast');
echo the_field('master_rost');
echo the_field('master_ves');
echo the_field('master_razmer');
echo the_post_thumbnail_url('mediuim');
if( have_posts() ) {
the_post();
the_content();
}
?>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>