Example WP Query Code
// WP_Query arguments
$args = array (
'p' => 'post-id',
'name' => 'post-slug',
'page_id' => 'page-id',
'pagename' => 'page-slug',
'post_parent' => 'children',
'post_type' => 'eros-webcast',
'category_name' => 'eros-webcast-type',
'pagination' => true,
'posts_per_page' => '5',
'posts_per_archive_page' => '5',
'ignore_sticky_posts' => false,
'order' => 'ASC',
'orderby' => 'date',
'meta_query' => array(
array(
'key' => 'webcast-date-time',
'value' => 'webcast-date-time-value',
'compare' => '>=',
'type' => 'DATETIME',
),
),
'cache_results' => true,
'update_post_meta_cache' => true,
'update_post_term_cache' => true,
);
// The Query
$ews_query = new WP_Query( $args );
// The Loop
if ( $ews_query->have_posts() ) {
while ( $ews_query->have_posts() ) {
$ews_query->the_post();
// do something
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();