/
widget-happening_now.php
42 lines (41 loc) · 1.28 KB
/
widget-happening_now.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
// Only show this widget if there are actually sessions happening right now
$args = array(
'post_type' => ONA12_Session::post_type,
'posts_per_page' => 20,
'meta_key' => '_ona12_start_timestamp',
'orderby' => 'meta_value',
'order' => 'asc',
'no_found_rows' => true,
'meta_query' => array(
'relation' => 'AND',
array(
'key' => '_ona12_start_timestamp',
'value' => time() - 25200,
'compare' => '<',
'type' => 'NUMERIC',
),
array(
'key' => '_ona12_end_timestamp',
'value' => time() - 25200,
'compare' => '>',
'type' => 'numeric',
),
),
);
$happening_now = new WP_Query( $args );
?>
<?php if ( $happening_now->have_posts() ): ?>
<section class="widget">
<h4>Happening Now</h4>
<ul>
<?php while( $happening_now->have_posts() ): $happening_now->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php if ( $location = ONA12_Session::get( 'location' ) ) {
echo ' - ' . $location;
} ?>
</li>
<?php endwhile; ?>
</ul>
</section>
<?php endif; ?>