How to display custom post types in a template. Wordpress open

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+
 $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();
0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation