Function Reference: geodir_get_neighbourhoods_dl
Summary
Get neighbourhoods in dropdown.
Global Values
- $wpdb
- (object) (required) WordPress Database object.
- Default: None
Package
GeoDirectory_Location_Manager
Parameters
- $city
- (string) (required)
- Default: None
- $selected_id
- (string) (required)
- Default: None
- $echo
- (bool) (required)
- Default: None
Return Values
- (string)
Change Log
Since: 1.0.0
Source File
geodir_get_neighbourhoods_dl() is located in geodir_location_manager/geodir_location_functions.php [Line: 1068]
Source Code
function geodir_get_neighbourhoods_dl($city='', $selected_id='', $echo = true) { global $wpdb; $neighbourhoods = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM ".POST_NEIGHBOURHOOD_TABLE." hood, ".POST_LOCATION_TABLE." location WHERE hood.hood_location_id = location.location_id AND location.city=%s ORDER BY hood_name ", array($city) ) ); $selectoptions = ''; if(!empty($neighbourhoods)){ $selectoptions = ''; foreach($neighbourhoods as $neighbourhood) { $selected = ''; if($neighbourhood->hood_slug == $selected_id) $selected = ' selected="selected" '; $selectoptions.= ''; } } if($echo) echo $selectoptions; else return $selectoptions; }