Support

Account

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;
    ?>