Created
October 25, 2016 08:43
-
-
Save oliwa/1be2c8007d3e91f4718c4026eff25c40 to your computer and use it in GitHub Desktop.
Custom Post Type Query (Events)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $today = date_i18n('Ymd'); | |
| $args = array( | |
| 'post_type' => 'events', | |
| 'posts_per_page' => -1, | |
| 'meta_key' => 'event_date', | |
| 'meta_compare' => '>=', | |
| 'meta_value' => $today, | |
| 'orderby' => 'meta_value', | |
| 'order' => 'asc', | |
| ); | |
| $events = new WP_Query( $args ); | |
| ?> | |
| <?php if( $events->have_posts() ) { ?> | |
| <?php while( $events->have_posts() ) { $events->the_post(); ?> | |
| <?php get_template_part('includes/loop-events'); ?> | |
| <?php } // end while ?> | |
| <?php wp_reset_postdata(); ?> | |
| <?php } // end if ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment