WordPress.org

Support

Support » Plugins and Hacks » [Resolved] WP_Query and scope of events

[Resolved] WP_Query and scope of events

  • afreyer

    @afreyer

    hi,

    i want to list next events with wp_query in my template ordered by a custom field.

    <?php 
    
    $args = array(
    	'post_type' => 'event',
    	'posts_per_page' => 10,
    'orderby' => 'meta_value_num',
    		'order' => 'ASC',
    		'meta_key' => '_start_ts',
    		'meta_value' => current_time('timestamp'),
    		'meta_value_num' => current_time('timestamp'),
    		'meta_compare' => '>=',
    
    	'meta_query' => array(
    		array(
    			'key' => 'color',
    			'value' => 'yellow',
    			'compare' => 'LIKE'
    		)
    	)
    );
    
    // the query
    $the_query = new WP_Query( $args ); ?>
    
    <?php if ( $the_query->have_posts() ) : ?>
    
      <!-- pagination here -->
    
      <!-- the loop -->
      <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    <?php the_title( '<p><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></p>' ); ?>
      <?php endwhile; ?>
      <!-- end of the loop -->
    
      <!-- pagination here -->
    
      <?php wp_reset_postdata(); ?>
    
    <?php else:  ?>
      <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
    <?php endif; ?>

    My Question: How could i manage this, if i want to show only events for the current week. does exist a scope parameter?

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

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] WP_Query and scope of events’ is closed to new replies.