Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // If setting timezone when saving data, $midnight += get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
- $args = array(
- 'post_type' => array( 'page' ),
- 'order' => 'DESC',
- 'orderby' => 'meta_value_num', // Numeric sort.
- 'meta_query' => array(
- array(
- 'key' => '_cmb2_live_start_test_datetime_timestamp',
- 'compare' => '<=',
- 'value' => time(),
- ),
- array(
- 'key' => '_cmb2_live_end_test_datetime_timestamp',
- 'compare' => '>=',
- 'vaule' => time(),
- ),
- ),
- 'posts_per_page' => 1,
- );
- $listen_query = new WP_Query( $args );
- ?>
- <?php if( $listen_query->have_posts() ): ?>
- <?php while ( $listen_query->have_posts() ) : $listen_query->the_post(); ?>
- <?php
- if ( ( time() > get_post_meta( get_the_ID(), '_cmb2_live_start_test_datetime_timestamp', true ) && ( time() < get_post_meta( get_the_ID(), '_cmb2_live_end_test_datetime_timestamp', true ) ) { ?>
- <a href="#"><span class="fa fa-microphone"></span><span class="listen">Live Broadcast!</span></a>
- <?php } ?>
- <?php endwhile; ?>
- <?php endif; ?>
- <?php wp_reset_query(); ?>
Advertisement
Add Comment
Please, Sign In to add comment