Standard Post Query
// WP_Query arguments
$args = array(
'post_type' => array( 'events' ),
'post_status' => array( 'publish' ),
'nopaging' => true,
'posts_per_page' => '-1',
'posts_per_archive_page' => '-1',
'ignore_sticky_posts' => false,
'order' => 'ASC',
'orderby' => 'date',
);
// The Query
$subs_event_query = new WP_Query( $args );
// The Loop
if ( $subs_event_query->have_posts() ) {
while ( $subs_event_query->have_posts() ) {
$subs_event_query->the_post();
// do something
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();