Current Exhibitions, WP vs Kirby

image

	<?php
	// Current
	$now_time = time() + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
    $args = array(
        'post_type' => array('exhibitions'),
        'posts_per_page' => -1,
        'meta_key' => 'event_timestrap_start',
        'orderby' => 'meta_value_num',
        'order' => 'ASC',
        'meta_query' => array(
            array(
                'key'     => 'event_timestrap_end',
                'value'   => $now_time,
                'compare' => '>'
            ),
            array(
                'key'     => 'event_timestrap_start',
                'value'   => $now_time,
                'compare' => '<'
            )
        )
    );
    $exhibitions = new WP_Query($args);
    ?>

image

    $current = $exhibitions->filterBy('startdate', 'date <=', 'today')->filterBy('enddate', 'date >=', 'today');

p.s. I know it is not elegant, but sometimes I wish there was a WP vs KB category :wink:

7 Likes