I have created a custom post type named rooms
. I would like to get all rooms
posts except for the one with the post id 164
, and display it using the code below:
<div class="room-container container room-grid">
<div class="heading-box">
<h2>rooms</h2>
</div>
<?php
$my_query = new WP_Query('post_type=rooms&posts_per_page=-1');
$c = 1;
while( $my_query->have_posts() ) :
$my_query->the_post();
$thumb = get_post_thumbnail_id();
$img_url = wp_get_attachment_url( $thumb );
$content = get_the_content();
?>
<div class="room-box col-xs-6">
<div class="img-container">
<img src="<?php echo $img_url; ?>" alt="rooms">
<a href="#" class="btn btn-default">More Details</a>
</div>
<div class="details">
<div class="title">
<a href="#"><?php echo get_the_title(); ?></a>
</div>
<div class="desc">
<?php echo substr( $content, 0, 200 ); ?>...
</div>
</div>
</div>
<?php $c++; endwhile; ?>
</div>