Support » Plugin: Events Manager » [Plugin: Events Manager] Query by Location

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Marcus

    (@netweblogic)

    you’d want to add a meta search condition for _location_id

    nevinlaughlin

    (@nevinlaughlin)

    I added this to the array and it just shows the last event but not in the location I want
    'meta_location_id' => 326

    <?php $my_query = new WP_Query( array( 'post_type' => 'event', 'showposts' => 1, 'meta_location_id' => 326 ));
    while ($my_query->have_posts()) : $my_query->the_post(); ?>

    Thanks!

    agelonwl

    (@angelonwl)

    did you try something like $my_query = new WP_Query( array( 'post_type' => 'event', 'showposts' => 1, '_location_id' => 4 ));

    nevinlaughlin

    (@nevinlaughlin)

    Thanks for replying, though this is ignoring the _location_id part…just shows the most recent event of all locations

    $my_query = new WP_Query( array( ‘post_type’ => ‘event’, ‘showposts’ => 1, ‘_location_id’ => 4 ));

    Thanks!

    agelonwl

    (@angelonwl)

    hi, don’t know if this will help you but try this docs – http://wp-events-plugin.com/documentation/advanced-usage/

    Plugin Author Marcus

    (@netweblogic)

    you’re doing it wrong, you need to do a (more correctly named) custom field search, as described here – http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters

    nevinlaughlin

    (@nevinlaughlin)

    nope still doesn’t work

    $my_query = new WP_Query( array( 'post_type' => 'event', 'showposts' => 1,
    								'meta_query' => array(
    									array(
    										'key' => '_location_id',
    										'value' => '326'
    									)
    								)
    							));
    nevinlaughlin

    (@nevinlaughlin)

    Though this time it doesn’t show any events rather than showing an event but not filtered by location.

    Plugin Author Marcus

    (@netweblogic)

    i can’t test this myself atm, but it looks right to me. maybe something else is wrong, e.g. wrong location id? or maybe nothing is being output, did you try print_r($my_query)?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Events Manager] Query by Location’ is closed to new replies.