Support » Plugin: Events Manager » How to show upcoming events in theme using WP_Query

  • Resolved benabrams

    (@benabrams)


    Hi

    I’ve been wrestling with this problem for a while now and cannot figure it out.

    I am using the meta query to get upcoming events within my custom theme. The code being used is thus;

    $args = array(	'post_type' => 'event',
    				'posts_per_page' => 10,
    				'meta_query' => array(
    					array(
    						'key' => 'event_start_date',
    						'value' => date('Ymd'),
    						'compare' => '>=',
    						'type' => 'DATE'
    						)),
    				'orderby' => 'event_start_date',
    				'order' => 'DESC'
     				 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();

    If i remove the meta_query portion, the query runs fine and orders the events by start date (just shows past events also).

    The query based currently as above returns no results whatsoever.

    Can anybody see where ive gone wrong?

    Thanks

    http://wordpress.org/extend/plugins/events-manager/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to show upcoming events in theme using WP_Query’ is closed to new replies.