Title: Show/Hide post based on time
Last modified: August 30, 2016

---

# Show/Hide post based on time

 *  [mfImran](https://wordpress.org/support/users/mfimran/)
 * (@mfimran)
 * [11 years ago](https://wordpress.org/support/topic/showhide-post-based-on-time/)
 * Hi,
 * I have a category called “Shows” where I post programs which broadcast on different
   days/time. What I want is to DISPLAY the program from “Shows” category based 
   on time/date.
 * For example:
    I have created a post which broadcast on Every Monday at 6:00 PM,
   what I want is to show the post on Monday 6:00 PM for about an hour and hides
   automatically and show again on next week Monday 6:00 PM only. I have installed
   ACF date&time picker plugin also. Here is my query:
 *     ```
       <?php
       global $post;
       $args = array('category' => 8, 'numberposts' => 4,'orderby' => 'date','order' => 'ASC',);
       $myposts = get_posts( $args );
       foreach( $myposts as $post ) : setup_postdata($post); ?>
       <?php
       $postDate = strtotime( $post->post_date );
       $todaysDate = time() - (time() % 86400);
       $todayTime = get_field('now_show_time');
       $time= time();
       if ( $postDate >= $todayTime) : ?>
       <li><a href="<?php the_permalink(); ?>" style="font-size:11px;"><span style="font-weight:bold;color:#afaca5"><?php the_time('n/j'); ?>:</span> <?php the_title_attribute(); ?></a></li>
       <?php endif; ?>
       <?php endforeach; ?>
       ```
   
 * Please help me to find a solution and tell me what am I doing wrong there?

The topic ‘Show/Hide post based on time’ is closed to new replies.

## Tags

 * [timepicker](https://wordpress.org/support/topic-tag/timepicker/)
 * [timestamp](https://wordpress.org/support/topic-tag/timestamp/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [mfImran](https://wordpress.org/support/users/mfimran/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/showhide-post-based-on-time/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
