WP自定义循环 - 根据工作日显示特定的CPT帖子

I'have CPT called godziny-otwarcia (in english: opening hours). I've got there 7 posts (each for one weekday: mon, tue..sunday). The content of this posts are opening hours like: 09.00 - 21.00. What I would like to achieve is to have a loop which will show opening hours for today.

So my current loop is:

<?php
   $args = array(
      'post_type' => 'godziny-otwarcia',
      'post__in' => array(1, 2, 3, 4, 5, 6, 7)
   );

   $query = new WP_Query($args);
   while ($query->have_posts()) : $query->the_post();
   ?>
      <div class="single-row">
         <div class="single-day">
           <span class="day-desc"><?php the_title(); ?></span>
           <span class="timing"><?php $opening_hours = types_render_field("opening-hours", array("raw"=>"true","separator"=>";")); echo $opening_hours; ?>  <i class="fa fa-clock-o"></i>
          </span>
         </div>
     </div>    

Then I know that I should make 7 different if statements to check the weekday:

if ( date ( 'w' ) == 1 ) {
    the_content();
    }
else if( date ( 'w' ) == 2 ) {
    the_content();
    }
else if( date ( 'w' ) == 3 ) {
    the_content();
    }
else if( date ( 'w' ) == 4 ) {
    the_content();
    }
else if( date ( 'w' ) == 5 ) {
    the_content();
    }
else if( date ( 'w' ) == 6 ) {
    the_content();
    }
else if( date ( 'w' ) == 0 ) {
    the_content();
}

But unfortuntelly - I have no clue how to connect the statement, with the loop ;/ is it even doable? Thank you for all the tips/suggestions..

You can try this:

if ( date ( 'w' ) == 1 ) {
    $monday = new WP_Query('post_type=godziny-otwarcia&p=1');
    echo $monday->the_content;
    }
else if( date ( 'w' ) == 2 ) {
    $tuesday = new WP_Query('post_type=godziny-otwarcia&p=2');
    echo $tuesday->the_content;
    }
else if( date ( 'w' ) == 3 ) {
    etc.
    }
else if( date ( 'w' ) == 4 ) {
    etc.
    }
else if( date ( 'w' ) == 5 ) {
    etc.
    }
else if( date ( 'w' ) == 6 ) {
    etc.
    }
else if( date ( 'w' ) == 0 ) {
    etc.
}

You don't need to put this in a loop.