Function Reference: geodir_sc_location_neighbourhood
Global Values
- $wpdb
- (object) (required) WordPress Database object.
- Default: None
Parameters
- ($atts) (required)
- Default: None
Return Values
- (string)
Source File
geodir_sc_location_neighbourhood() is located in geodir_location_manager/geodir_location_shortcodes.php [Line: 153]
Source Code
function geodir_sc_location_neighbourhood( $atts ) {
global $wpdb;
ob_start();
$location_id = '';
if ( $gd_city = get_query_var( 'gd_city' ) ) {
$location_id = $wpdb->get_var( $wpdb->prepare( "SELECT location_id from " . POST_LOCATION_TABLE . " WHERE city_slug=%s", array( $gd_city ) ) );
}
$gd_neighbourhoods = geodir_get_neighbourhoods( $location_id );
$location_request = array();
$location_request[] = get_query_var( 'gd_country' );
$location_request[] = get_query_var( 'gd_region' );
$location_request[] = get_query_var( 'gd_city' );
if ( $gd_neighbourhoods ) {
?>
';
foreach ( $gd_neighbourhoods as $gd_neighbourhood ) {
if ( $hood_count % 15 == 0 ) {
echo '';
}
$neighbourhood_action = esc_url( add_query_arg( array( 'gd_neighbourhood' => $gd_neighbourhood->hood_slug ), rtrim( geodir_get_location_link( 'current' ), '/' ) . '/' ) );
echo '- ' . ucwords( $gd_neighbourhood->hood_name ) . '
';
$hood_count ++;
}
echo '
';
?>