$args = array( 'post_type' => 'reviews' ); $properties = new WP_Query($args); if($properties->have_posts()) { while ($properties->have_posts()) { $properties->the_post(); get_template_part('inc/reviews'); } } else { echo esc_html__( 'No Posts', 'lang-domain' ); } wp_reset_postdata();
How to display custom post types in a template. Wordpress
Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators
Tested: WordPress 1+