eo_get_venues
since 1.0.0
eo_get_venues( $args = array() )
Retrieve array of venues. Acts as a wrapper for get_terms(), except hide_empty defaults to false.
The list of arguments that $args
can contain, which will overwrite the defaults:
- orderby - Default is 'name'. Can be name, count, slug, city, state, country, postcode, address
or distance (when used with a proximity-query)
- order - ASC|DESC Default is ASC.
- hide_empty - Default is 0 (false)
- exclude - Default is an empty array. An array, comma- or space-delimited string
of term ids to exclude from the return array. If 'include' is non-empty,
'exclude' is ignored.
- include - Default is an empty array. An array, comma- or space-delimited string
of term ids to include in the return array.
- number - The maximum number of terms to return. Default is to return them all.
- offset - The number by which to offset the terms query.
- fields - Default is 'all', which returns an array of term objects.
If 'fields' is 'ids' or 'names', returns an array of integers or strings, respectively.
- slug - Returns terms whose "slug" matches this value. Default is empty string.
- search - Returned terms' names will contain the value of 'search',
- case-insensitive. Default is an empty string.
Example
$venues = eo_get_venues();
if( $venues ){
echo '<ul>';
foreach($venues as $venue):
$venue_id = (int) $venue->term_id;
printf('<li> <a href="%s">%s</a>', eo_get_venue_link($venue_id), esc_html($venue->name));
endforeach;
echo '</ul>';
}
The retreive all venues within 10 miles of Windsor Castle
$meta_query = array(
'proximity' => array(
'center' => eo_remote_geocode( "Windsor [castle]" ),
'distance' => 10,
'unit' => 'miles',
'compare' => '<='
),
);
$venues = eo_get_venues( array( 'meta_query' => $meta_query ) );
See documentation on venue meta queries.
Parameters
string|array
|
$args = array() |
The values of what to search for when returning venues
|
Return value
array
|
List of Term (venue) Objects
|
Changelog
Related
Resources