$start_date = date( 'ym01' ); $end_date = date( 'ymt' ); $meta_query = array( 'key' => 'event_date', 'value' => array( $start_date, $end_date ), 'compare' => 'BETWEEN', 'type' => 'NUMERIC' ); $args = array( 'post_type' => 'spektakle_event', 'posts_per_page' => -1, 'orderby' => 'meta_value', 'meta_key' => 'event_date', 'order' => 'ASC', 'meta_query' => array( $meta_query ) ); $the_query = new WP_Query( $args );
I used this code on CPT page-spektakle-event.php to display only this month events. But how can I make navigation to display next month or next to next month events ? Custom post type has custom field event_date with yyyymmdd format.
Or maybe simpler idea (but I don't know how to build query) that page will check what month is now and display only that events which have the same number in custom field ( i know how to make that field :D ) and navigation will be addin +1 or -1 to search through next and previous month events.... any help ?