Skip to content

Instantly share code, notes, and snippets.

@zanematthew
Created June 16, 2012 16:07
Show Gist options
  • Save zanematthew/2941796 to your computer and use it in GitHub Desktop.
Save zanematthew/2941796 to your computer and use it in GitHub Desktop.
Venue by Region and Local Venues
<?php
/**
* Returns the ID of all Venues in a given Region (full region)
*/
public function getVenueByRegion( $region=null ){
$args = array(
'post_type' => 'tracks',
'posts_per_page' => -1,
'post_status' => 'published',
'meta_query' => array(
array(
'key' => 'tracks_state',
'value' => $region,
'compare' => '='
)
)
);
$query = new WP_Query( $args );
return $query->posts;
}
/**
* Determine local venues based on current location.
*
* @return Full query_posts for local venues.
*/
public function getLocalVenues(){
$location = bmx_rs_get_user_location();
return $this->getVenueByRegion( $location['region_full'] );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment