Home › Forums › General Issues › Loop using selection field to display content › Reply To: Loop using selection field to display content
Hi,
I think your main issue is that you’re not using the posttype slug for post_type.
Also unless you set posts_per_page it will default to your setting in wp admin.
<?php
$args = array(
'post_type' => 'professor',
'meta_query' => array(
array(
'key' => 'area_do_professor',
'value' => 'Treinamento_Total',
'compare' => '='
)
),
'posts_per_page' => -1
);
$queryTreina = new WP_Query($args);
if ($queryTreina->have_posts()) : while ($queryTreina->have_posts()) : $queryTreina->the_post();
the_title(); //to make sure it works
get_template_part('partials/content', 'professores');
endwhile;
endif;
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.