WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] How to show upcoming events in theme using WP_Query (2 posts)

  1. benabrams
    Member
    Posted 1 year ago #

    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/

  2. agelonwl
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic