Hotel Query
// WP_Query arguments
$args = array (
'post_type' => array( 'hotel' ),
'post_status' => array( 'publish' ),
'nopaging' => true,
'posts_per_page' => '10',
'posts_per_archive_page' => '10',
'ignore_sticky_posts' => true,
'order' => 'ASC',
'orderby' => 'title',
'meta_query' => array(
array(
'key' => 'location',
'value' => 'Rome',
'compare' => '=',
),
),
);
// The Query
$hotel = new WP_Query( $args );
// The Loop
if ( $hotel->have_posts() ) {
while ( $hotel->have_posts() ) {
$hotel->the_post();
// do something
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();